Merge pull request #4532 from johnelliott/master

Add MacVim as a supported external editor for macOS
This commit is contained in:
William Shepherd 2018-05-08 11:59:17 -05:00 committed by GitHub
commit 171bf55ea0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View file

@ -5,6 +5,7 @@ import { assertNever } from '../fatal-error'
export enum ExternalEditor {
Atom = 'Atom',
MacVim = 'MacVim',
VisualStudioCode = 'Visual Studio Code',
VisualStudioCodeInsiders = 'Visual Studio Code (Insiders)',
SublimeText = 'Sublime Text',
@ -18,6 +19,9 @@ export function parse(label: string): ExternalEditor | null {
if (label === ExternalEditor.Atom) {
return ExternalEditor.Atom
}
if (label === ExternalEditor.MacVim) {
return ExternalEditor.MacVim
}
if (label === ExternalEditor.VisualStudioCode) {
return ExternalEditor.VisualStudioCode
}
@ -51,6 +55,8 @@ function getBundleIdentifiers(editor: ExternalEditor): ReadonlyArray<string> {
switch (editor) {
case ExternalEditor.Atom:
return ['com.github.atom']
case ExternalEditor.MacVim:
return ['org.vim.MacVim']
case ExternalEditor.VisualStudioCode:
return ['com.microsoft.VSCode']
case ExternalEditor.VisualStudioCodeInsiders:
@ -87,6 +93,8 @@ function getExecutableShim(
'bin',
'code'
)
case ExternalEditor.MacVim:
return Path.join(installPath, 'Contents', 'MacOS', 'MacVim')
case ExternalEditor.SublimeText:
return Path.join(installPath, 'Contents', 'SharedSupport', 'bin', 'subl')
case ExternalEditor.BBEdit:
@ -133,6 +141,7 @@ export async function getAvailableEditors(): Promise<
const [
atomPath,
macVimPath,
codePath,
codeInsidersPath,
sublimePath,
@ -142,6 +151,7 @@ export async function getAvailableEditors(): Promise<
textMatePath,
] = await Promise.all([
findApplication(ExternalEditor.Atom),
findApplication(ExternalEditor.MacVim),
findApplication(ExternalEditor.VisualStudioCode),
findApplication(ExternalEditor.VisualStudioCodeInsiders),
findApplication(ExternalEditor.SublimeText),
@ -155,6 +165,10 @@ export async function getAvailableEditors(): Promise<
results.push({ editor: ExternalEditor.Atom, path: atomPath })
}
if (macVimPath) {
results.push({ editor: ExternalEditor.MacVim, path: macVimPath })
}
if (codePath) {
results.push({ editor: ExternalEditor.VisualStudioCode, path: codePath })
}

View file

@ -205,6 +205,7 @@ The source for the editor integration on macOS is found in
These editors are currently supported:
- [Atom](https://atom.io/)
- [MacVim](https://macvim-dev.github.io/macvim/)
- [Visual Studio Code](https://code.visualstudio.com/) - both stable and Insiders channel
- [Sublime Text](https://www.sublimetext.com/)
- [BBEdit](http://www.barebones.com/products/bbedit/)
@ -218,6 +219,7 @@ These are defined in an enum at the top of the file:
export enum ExternalEditor {
Atom = 'Atom',
MacVim = 'MacVim',
VisualStudioCode = 'Visual Studio Code',
VisualStudioCodeInsiders = 'Visual Studio Code (Insiders)',
SublimeText = 'Sublime Text',