mirror of
https://github.com/desktop/desktop
synced 2024-10-30 06:03:10 +00:00
Merge pull request #15780 from tsvetilian-ty/jetbrains-toolbox-support
Support for JetBrains Toolbox and JetBrains Fleet editor
This commit is contained in:
commit
ced3ceae7a
3 changed files with 97 additions and 0 deletions
|
@ -144,6 +144,10 @@ const editors: IDarwinExternalEditor[] = [
|
|||
name: 'Lite XL',
|
||||
bundleIdentifiers: ['com.lite-xl'],
|
||||
},
|
||||
{
|
||||
name: 'Fleet',
|
||||
bundleIdentifiers: ['Fleet.app'],
|
||||
},
|
||||
]
|
||||
|
||||
async function findApplication(
|
||||
|
|
|
@ -60,6 +60,16 @@ type WindowsExternalEditor = {
|
|||
|
||||
/** Value of the Publisher registry key that belongs to this editor. */
|
||||
readonly publisher: string
|
||||
|
||||
/**
|
||||
* Default shell script name for JetBrains Product
|
||||
* To get the script name go to:
|
||||
* JetBrains Toolbox > Editor settings > Shell script name
|
||||
*
|
||||
* Go to `/docs/techical/editor-integration.md` for more information on
|
||||
* how to use this field.
|
||||
*/
|
||||
readonly jetBrainsToolboxScriptName?: string
|
||||
} & WindowsExternalEditorPathInfo
|
||||
|
||||
const registryKey = (key: HKEY, ...subKeys: string[]): RegistryKey => ({
|
||||
|
@ -312,6 +322,7 @@ const editors: WindowsExternalEditor[] = [
|
|||
name: 'JetBrains Webstorm',
|
||||
registryKeys: registryKeysForJetBrainsIDE('WebStorm'),
|
||||
executableShimPaths: executableShimPathsForJetBrainsIDE('webstorm'),
|
||||
jetBrainsToolboxScriptName: 'webstorm',
|
||||
displayNamePrefix: 'WebStorm',
|
||||
publisher: 'JetBrains s.r.o.',
|
||||
},
|
||||
|
@ -319,6 +330,7 @@ const editors: WindowsExternalEditor[] = [
|
|||
name: 'JetBrains Phpstorm',
|
||||
registryKeys: registryKeysForJetBrainsIDE('PhpStorm'),
|
||||
executableShimPaths: executableShimPathsForJetBrainsIDE('phpstorm'),
|
||||
jetBrainsToolboxScriptName: 'phpstorm',
|
||||
displayNamePrefix: 'PhpStorm',
|
||||
publisher: 'JetBrains s.r.o.',
|
||||
},
|
||||
|
@ -326,6 +338,7 @@ const editors: WindowsExternalEditor[] = [
|
|||
name: 'Android Studio',
|
||||
registryKeys: [LocalMachineUninstallKey('Android Studio')],
|
||||
installLocationRegistryKey: 'UninstallString',
|
||||
jetBrainsToolboxScriptName: 'studio',
|
||||
executableShimPaths: [
|
||||
['..', 'bin', `studio64.exe`],
|
||||
['..', 'bin', `studio.exe`],
|
||||
|
@ -349,6 +362,7 @@ const editors: WindowsExternalEditor[] = [
|
|||
name: 'JetBrains Rider',
|
||||
registryKeys: registryKeysForJetBrainsIDE('JetBrains Rider'),
|
||||
executableShimPaths: executableShimPathsForJetBrainsIDE('rider'),
|
||||
jetBrainsToolboxScriptName: 'rider',
|
||||
displayNamePrefix: 'JetBrains Rider',
|
||||
publisher: 'JetBrains s.r.o.',
|
||||
},
|
||||
|
@ -363,6 +377,7 @@ const editors: WindowsExternalEditor[] = [
|
|||
name: 'JetBrains IntelliJ Idea',
|
||||
registryKeys: registryKeysForJetBrainsIDE('IntelliJ IDEA'),
|
||||
executableShimPaths: executableShimPathsForJetBrainsIDE('idea'),
|
||||
jetBrainsToolboxScriptName: 'idea',
|
||||
displayNamePrefix: 'IntelliJ IDEA ',
|
||||
publisher: 'JetBrains s.r.o.',
|
||||
},
|
||||
|
@ -379,6 +394,7 @@ const editors: WindowsExternalEditor[] = [
|
|||
name: 'JetBrains PyCharm',
|
||||
registryKeys: registryKeysForJetBrainsIDE('PyCharm'),
|
||||
executableShimPaths: executableShimPathsForJetBrainsIDE('pycharm'),
|
||||
jetBrainsToolboxScriptName: 'pycharm',
|
||||
displayNamePrefix: 'PyCharm ',
|
||||
publisher: 'JetBrains s.r.o.',
|
||||
},
|
||||
|
@ -393,6 +409,7 @@ const editors: WindowsExternalEditor[] = [
|
|||
name: 'JetBrains CLion',
|
||||
registryKeys: registryKeysForJetBrainsIDE('CLion'),
|
||||
executableShimPaths: executableShimPathsForJetBrainsIDE('clion'),
|
||||
jetBrainsToolboxScriptName: 'clion',
|
||||
displayNamePrefix: 'CLion ',
|
||||
publisher: 'JetBrains s.r.o.',
|
||||
},
|
||||
|
@ -400,6 +417,7 @@ const editors: WindowsExternalEditor[] = [
|
|||
name: 'JetBrains RubyMine',
|
||||
registryKeys: registryKeysForJetBrainsIDE('RubyMine'),
|
||||
executableShimPaths: executableShimPathsForJetBrainsIDE('rubymine'),
|
||||
jetBrainsToolboxScriptName: 'rubymine',
|
||||
displayNamePrefix: 'RubyMine ',
|
||||
publisher: 'JetBrains s.r.o.',
|
||||
},
|
||||
|
@ -407,9 +425,18 @@ const editors: WindowsExternalEditor[] = [
|
|||
name: 'JetBrains GoLand',
|
||||
registryKeys: registryKeysForJetBrainsIDE('GoLand'),
|
||||
executableShimPaths: executableShimPathsForJetBrainsIDE('goland'),
|
||||
jetBrainsToolboxScriptName: 'goland',
|
||||
displayNamePrefix: 'GoLand ',
|
||||
publisher: 'JetBrains s.r.o.',
|
||||
},
|
||||
{
|
||||
name: 'JetBrains Fleet',
|
||||
registryKeys: [LocalMachineUninstallKey('Fleet')],
|
||||
jetBrainsToolboxScriptName: 'fleet',
|
||||
installLocationRegistryKey: 'DisplayIcon',
|
||||
displayNamePrefix: 'Fleet ',
|
||||
publisher: 'JetBrains s.r.o.',
|
||||
},
|
||||
]
|
||||
|
||||
function getKeyOrEmpty(
|
||||
|
@ -465,6 +492,39 @@ async function findApplication(editor: WindowsExternalEditor) {
|
|||
}
|
||||
}
|
||||
|
||||
return findJetBrainsToolboxApplication(editor)
|
||||
}
|
||||
|
||||
/**
|
||||
* Find JetBrain products installed through JetBrains Toolbox
|
||||
*/
|
||||
async function findJetBrainsToolboxApplication(editor: WindowsExternalEditor) {
|
||||
if (!editor.jetBrainsToolboxScriptName) {
|
||||
return null
|
||||
}
|
||||
|
||||
const toolboxRegistryReference = [
|
||||
CurrentUserUninstallKey('toolbox'),
|
||||
Wow64LocalMachineUninstallKey('toolbox'),
|
||||
]
|
||||
|
||||
for (const { key, subKey } of toolboxRegistryReference) {
|
||||
const keys = enumerateValues(key, subKey)
|
||||
if (keys.length > 0) {
|
||||
const editorPathInToolbox = Path.join(
|
||||
getKeyOrEmpty(keys, 'UninstallString'),
|
||||
'..',
|
||||
'..',
|
||||
'scripts',
|
||||
`${editor.jetBrainsToolboxScriptName}.cmd`
|
||||
)
|
||||
const exists = await pathExists(editorPathInToolbox)
|
||||
if (exists) {
|
||||
return editorPathInToolbox
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ These editors are currently supported:
|
|||
- [Notepad++](https://notepad-plus-plus.org/)
|
||||
- [RStudio](https://rstudio.com/)
|
||||
- [Aptana Studio](http://www.aptana.com/)
|
||||
- [JetBrains Fleet](https://www.jetbrains.com/fleet/)
|
||||
|
||||
These are defined in a list at the top of the file:
|
||||
|
||||
|
@ -203,6 +204,37 @@ location with an interface that doesn't change between updates.
|
|||
Desktop will confirm this file exists on disk before launching - if it's
|
||||
missing or lost it won't let you launch the external editor.
|
||||
|
||||
### Support for JetBrains Toolbox editors
|
||||
|
||||
Now GitHub Desktop support editors installed through JetBrains Toolbox.
|
||||
The technique used to achieve that is using `jetBrainsToolboxScriptName` field
|
||||
to check if, in the default section for scripts in JetBrainsm Toolbox, a script
|
||||
with the corresponding name exists.
|
||||
|
||||
```ts
|
||||
{
|
||||
name: 'JetBrains PyCharm',
|
||||
...
|
||||
jetBrainsToolboxScriptName: 'pycharm',
|
||||
},
|
||||
```
|
||||
|
||||
**Note:** Use `jetBrainsToolboxScriptName` field only on the main edition of
|
||||
the product. When JetBrains Toolbox generates the scripts, it doesn't consider the
|
||||
different editions, so when a new product edition is installed, it generates a
|
||||
shell script with the same name that overrides the existing one. So it's
|
||||
impossible to differentiate between the various editions of the same product.
|
||||
|
||||
**Overriding example:**
|
||||
1. Install JetBrains PyCharm Community
|
||||
2. At this point, JetBrains Toolbox will generate a shell script called `pycharm`
|
||||
3. Install JetBrains PyCharm Professional
|
||||
4. JetBrains Toolbox will generate a new script with the same name, `pycharm`
|
||||
and will override the script generated for the community version
|
||||
|
||||
The current method supports only the default generated JetBrains Toolbox shell
|
||||
scripts.
|
||||
|
||||
## macOS
|
||||
|
||||
The source for the editor integration on macOS is found in
|
||||
|
@ -238,6 +270,7 @@ These editors are currently supported:
|
|||
- [Aptana Studio](http://www.aptana.com/)
|
||||
- [Emacs](https://www.gnu.org/software/emacs/)
|
||||
- [Lite XL](https://lite-xl.com/)
|
||||
- [JetBrains Fleet](https://www.jetbrains.com/fleet/)
|
||||
|
||||
These are defined in a list at the top of the file:
|
||||
|
||||
|
|
Loading…
Reference in a new issue