Add suport for IntelliJ Idea on Mac

This commit is contained in:
Gustavo Bazan 2019-10-03 17:43:23 +01:00
parent b250c1da24
commit 67bfa79e72
No known key found for this signature in database
GPG key ID: D02D8BF462322985
2 changed files with 18 additions and 3 deletions

View file

@ -19,6 +19,7 @@ export enum ExternalEditor {
Typora = 'Typora',
CodeRunner = 'CodeRunner',
SlickEdit = 'SlickEdit',
IntelliJ = 'IntelliJ',
}
export function parse(label: string): ExternalEditor | null {
@ -69,6 +70,9 @@ export function parse(label: string): ExternalEditor | null {
if (label === ExternalEditor.SlickEdit) {
return ExternalEditor.SlickEdit
}
if (label === ExternalEditor.IntelliJ) {
return ExternalEditor.IntelliJ
}
return null
}
@ -97,6 +101,8 @@ function getBundleIdentifiers(editor: ExternalEditor): ReadonlyArray<string> {
return ['com.jetbrains.PhpStorm']
case ExternalEditor.RubyMine:
return ['com.jetbrains.RubyMine']
case ExternalEditor.IntelliJ:
return ['com.jetbrains.intellij']
case ExternalEditor.TextMate:
return ['com.macromates.TextMate']
case ExternalEditor.Brackets:
@ -161,6 +167,8 @@ function getExecutableShim(
return Path.join(installPath, 'Contents', 'MacOS', 'Brackets')
case ExternalEditor.WebStorm:
return Path.join(installPath, 'Contents', 'MacOS', 'WebStorm')
case ExternalEditor.IntelliJ:
return Path.join(installPath, 'Contents', 'MacOS', 'idea')
case ExternalEditor.Typora:
return Path.join(installPath, 'Contents', 'MacOS', 'Typora')
case ExternalEditor.CodeRunner:
@ -217,6 +225,7 @@ export async function getAvailableEditors(): Promise<
typoraPath,
codeRunnerPath,
slickeditPath,
intellijPath,
] = await Promise.all([
findApplication(ExternalEditor.Atom),
findApplication(ExternalEditor.MacVim),
@ -233,6 +242,7 @@ export async function getAvailableEditors(): Promise<
findApplication(ExternalEditor.Typora),
findApplication(ExternalEditor.CodeRunner),
findApplication(ExternalEditor.SlickEdit),
findApplication(ExternalEditor.IntelliJ),
])
if (atomPath) {
@ -298,5 +308,9 @@ export async function getAvailableEditors(): Promise<
results.push({ editor: ExternalEditor.SlickEdit, path: slickeditPath })
}
if (intellijPath) {
results.push({ editor: ExternalEditor.IntelliJ, path: intellijPath })
}
return results
}

View file

@ -157,7 +157,7 @@ function extractApplicationInformation(
const installLocation = getKeyOrEmpty(keys, 'InstallLocation')
return { displayName, publisher, installLocation }
}
...
}
```
@ -218,7 +218,7 @@ 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.
If the external editor utilizes a CMD.EXE shell script to launch, Desktop
needs to know this in order to properly launch the CMD.EXE shell. This is
needs to know this in order to properly launch the CMD.EXE shell. This is
done by setting the property `usesShell: true` in `getAvailableEditors`.
```ts
@ -255,6 +255,7 @@ These editors are currently supported:
- [BBEdit](http://www.barebones.com/products/bbedit/)
- [PhpStorm](https://www.jetbrains.com/phpstorm/)
- [RubyMine](https://www.jetbrains.com/rubymine/)
- [IntelliJ IDEA](https://www.jetbrains.com/idea/)
- [TextMate](https://macromates.com)
- [Brackets](http://brackets.io/)
- To use Brackets the Command Line shortcut must be installed.
@ -420,7 +421,7 @@ export async function getAvailableEditors(): Promise<
getEditorPath(ExternalEditor.Typora),
getEditorPath(ExternalEditor.SlickEdit),
])
...
if (codePath) {