Skip to content

Commit

Permalink
Merge branch 'development' into 8156-openExternal
Browse files Browse the repository at this point in the history
  • Loading branch information
kuychaco authored Sep 7, 2019
2 parents 1ef96b2 + 44ed65a commit 04b940d
Show file tree
Hide file tree
Showing 21 changed files with 409 additions and 158 deletions.
29 changes: 1 addition & 28 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,5 @@ coverage:
round: nearest
# thresholds for red to green color coding
range: '10...80'

status:
project:
lib-git:
target: auto
threshold: 5%
base: pr
paths: 'app/src/lib/git'
lib-app:
target: auto
threshold: 5%
base: pr
paths:
- 'app/src/lib/stores'
- 'app/src/lib/databases'
models:
target: auto
threshold: 5%
base: pr
paths: 'app/src/models'
ui-components:
target: auto
threshold: 5%
base: pr
paths: 'app/src/ui'
patch: no
changes: no

status: off
comment: off
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ app/node_modules/
*.iml
.envrc
junit*.xml
*.swp
4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"productName": "GitHub Desktop",
"bundleID": "com.github.GitHubClient",
"companyName": "GitHub, Inc.",
"version": "2.1.1-beta4",
"version": "2.1.3",
"main": "./main.js",
"repository": {
"type": "git",
Expand All @@ -26,7 +26,7 @@
"deep-equal": "^1.0.1",
"dexie": "^2.0.0",
"double-ended-queue": "^2.1.0-0",
"dugite": "1.87.1",
"dugite": "1.87.2",
"electron-window-state": "^5.0.3",
"event-kit": "^2.0.0",
"file-uri-to-path": "0.0.2",
Expand Down
65 changes: 51 additions & 14 deletions app/src/lib/editors/darwin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import { assertNever } from '../fatal-error'
export enum ExternalEditor {
Atom = 'Atom',
MacVim = 'MacVim',
VisualStudioCode = 'Visual Studio Code',
VisualStudioCodeInsiders = 'Visual Studio Code (Insiders)',
VSCode = 'Visual Studio Code',
VSCodeInsiders = 'Visual Studio Code (Insiders)',
VSCodium = 'VSCodium',
SublimeText = 'Sublime Text',
BBEdit = 'BBEdit',
PhpStorm = 'PhpStorm',
Expand All @@ -16,6 +17,7 @@ export enum ExternalEditor {
Brackets = 'Brackets',
WebStorm = 'WebStorm',
Typora = 'Typora',
CodeRunner = 'CodeRunner',
SlickEdit = 'SlickEdit',
}

Expand All @@ -26,12 +28,17 @@ export function parse(label: string): ExternalEditor | null {
if (label === ExternalEditor.MacVim) {
return ExternalEditor.MacVim
}
if (label === ExternalEditor.VisualStudioCode) {
return ExternalEditor.VisualStudioCode
if (label === ExternalEditor.VSCode) {
return ExternalEditor.VSCode
}
if (label === ExternalEditor.VisualStudioCodeInsiders) {
return ExternalEditor.VisualStudioCodeInsiders
if (label === ExternalEditor.VSCodeInsiders) {
return ExternalEditor.VSCodeInsiders
}

if (label === ExternalEditor.VSCodium) {
return ExternalEditor.VSCodium
}

if (label === ExternalEditor.SublimeText) {
return ExternalEditor.SublimeText
}
Expand All @@ -56,6 +63,9 @@ export function parse(label: string): ExternalEditor | null {
if (label === ExternalEditor.Typora) {
return ExternalEditor.Typora
}
if (label === ExternalEditor.CodeRunner) {
return ExternalEditor.CodeRunner
}
if (label === ExternalEditor.SlickEdit) {
return ExternalEditor.SlickEdit
}
Expand All @@ -73,10 +83,12 @@ function getBundleIdentifiers(editor: ExternalEditor): ReadonlyArray<string> {
return ['com.github.atom']
case ExternalEditor.MacVim:
return ['org.vim.MacVim']
case ExternalEditor.VisualStudioCode:
case ExternalEditor.VSCode:
return ['com.microsoft.VSCode']
case ExternalEditor.VisualStudioCodeInsiders:
case ExternalEditor.VSCodeInsiders:
return ['com.microsoft.VSCodeInsiders']
case ExternalEditor.VSCodium:
return ['com.visualstudio.code.oss']
case ExternalEditor.SublimeText:
return ['com.sublimetext.3']
case ExternalEditor.BBEdit:
Expand All @@ -93,6 +105,8 @@ function getBundleIdentifiers(editor: ExternalEditor): ReadonlyArray<string> {
return ['com.jetbrains.WebStorm']
case ExternalEditor.Typora:
return ['abnerworks.Typora']
case ExternalEditor.CodeRunner:
return ['com.krill.CodeRunner']
case ExternalEditor.SlickEdit:
return [
'com.slickedit.SlickEditPro2018',
Expand All @@ -112,8 +126,8 @@ function getExecutableShim(
switch (editor) {
case ExternalEditor.Atom:
return Path.join(installPath, 'Contents', 'Resources', 'app', 'atom.sh')
case ExternalEditor.VisualStudioCode:
case ExternalEditor.VisualStudioCodeInsiders:
case ExternalEditor.VSCode:
case ExternalEditor.VSCodeInsiders:
return Path.join(
installPath,
'Contents',
Expand All @@ -122,6 +136,15 @@ function getExecutableShim(
'bin',
'code'
)
case ExternalEditor.VSCodium:
return Path.join(
installPath,
'Contents',
'Resources',
'app',
'bin',
'codium'
)
case ExternalEditor.MacVim:
return Path.join(installPath, 'Contents', 'MacOS', 'MacVim')
case ExternalEditor.SublimeText:
Expand All @@ -140,6 +163,8 @@ function getExecutableShim(
return Path.join(installPath, 'Contents', 'MacOS', 'WebStorm')
case ExternalEditor.Typora:
return Path.join(installPath, 'Contents', 'MacOS', 'Typora')
case ExternalEditor.CodeRunner:
return Path.join(installPath, 'Contents', 'MacOS', 'CodeRunner')
case ExternalEditor.SlickEdit:
return Path.join(installPath, 'Contents', 'MacOS', 'vs')
default:
Expand Down Expand Up @@ -181,6 +206,7 @@ export async function getAvailableEditors(): Promise<
macVimPath,
codePath,
codeInsidersPath,
codiumPath,
sublimePath,
bbeditPath,
phpStormPath,
Expand All @@ -189,12 +215,14 @@ export async function getAvailableEditors(): Promise<
bracketsPath,
webStormPath,
typoraPath,
codeRunnerPath,
slickeditPath,
] = await Promise.all([
findApplication(ExternalEditor.Atom),
findApplication(ExternalEditor.MacVim),
findApplication(ExternalEditor.VisualStudioCode),
findApplication(ExternalEditor.VisualStudioCodeInsiders),
findApplication(ExternalEditor.VSCode),
findApplication(ExternalEditor.VSCodeInsiders),
findApplication(ExternalEditor.VSCodium),
findApplication(ExternalEditor.SublimeText),
findApplication(ExternalEditor.BBEdit),
findApplication(ExternalEditor.PhpStorm),
Expand All @@ -203,6 +231,7 @@ export async function getAvailableEditors(): Promise<
findApplication(ExternalEditor.Brackets),
findApplication(ExternalEditor.WebStorm),
findApplication(ExternalEditor.Typora),
findApplication(ExternalEditor.CodeRunner),
findApplication(ExternalEditor.SlickEdit),
])

Expand All @@ -215,16 +244,20 @@ export async function getAvailableEditors(): Promise<
}

if (codePath) {
results.push({ editor: ExternalEditor.VisualStudioCode, path: codePath })
results.push({ editor: ExternalEditor.VSCode, path: codePath })
}

if (codeInsidersPath) {
results.push({
editor: ExternalEditor.VisualStudioCodeInsiders,
editor: ExternalEditor.VSCodeInsiders,
path: codeInsidersPath,
})
}

if (codiumPath) {
results.push({ editor: ExternalEditor.VSCodium, path: codiumPath })
}

if (sublimePath) {
results.push({ editor: ExternalEditor.SublimeText, path: sublimePath })
}
Expand Down Expand Up @@ -257,6 +290,10 @@ export async function getAvailableEditors(): Promise<
results.push({ editor: ExternalEditor.Typora, path: typoraPath })
}

if (codeRunnerPath) {
results.push({ editor: ExternalEditor.CodeRunner, path: codeRunnerPath })
}

if (slickeditPath) {
results.push({ editor: ExternalEditor.SlickEdit, path: slickeditPath })
}
Expand Down
40 changes: 25 additions & 15 deletions app/src/lib/editors/linux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { assertNever } from '../fatal-error'

export enum ExternalEditor {
Atom = 'Atom',
VisualStudioCode = 'Visual Studio Code',
VisualStudioCodeInsiders = 'Visual Studio Code (Insiders)',
VSCode = 'Visual Studio Code',
VSCodeInsiders = 'Visual Studio Code (Insiders)',
VSCodium = 'VSCodium',
SublimeText = 'Sublime Text',
Typora = 'Typora',
SlickEdit = 'SlickEdit',
Expand All @@ -17,12 +18,16 @@ export function parse(label: string): ExternalEditor | null {
return ExternalEditor.Atom
}

if (label === ExternalEditor.VisualStudioCode) {
return ExternalEditor.VisualStudioCode
if (label === ExternalEditor.VSCode) {
return ExternalEditor.VSCode
}

if (label === ExternalEditor.VisualStudioCodeInsiders) {
return ExternalEditor.VisualStudioCode
if (label === ExternalEditor.VSCodeInsiders) {
return ExternalEditor.VSCode
}

if (label === ExternalEditor.VSCodium) {
return ExternalEditor.VSCodium
}

if (label === ExternalEditor.SublimeText) {
Expand All @@ -48,10 +53,12 @@ async function getEditorPath(editor: ExternalEditor): Promise<string | null> {
switch (editor) {
case ExternalEditor.Atom:
return getPathIfAvailable('/usr/bin/atom')
case ExternalEditor.VisualStudioCode:
case ExternalEditor.VSCode:
return getPathIfAvailable('/usr/bin/code')
case ExternalEditor.VisualStudioCodeInsiders:
case ExternalEditor.VSCodeInsiders:
return getPathIfAvailable('/usr/bin/code-insiders')
case ExternalEditor.VSCodium:
return getPathIfAvailable('/usr/bin/codium')
case ExternalEditor.SublimeText:
return getPathIfAvailable('/usr/bin/subl')
case ExternalEditor.Typora:
Expand Down Expand Up @@ -84,13 +91,15 @@ export async function getAvailableEditors(): Promise<
atomPath,
codePath,
codeInsidersPath,
codiumPath,
sublimePath,
typoraPath,
slickeditPath,
] = await Promise.all([
getEditorPath(ExternalEditor.Atom),
getEditorPath(ExternalEditor.VisualStudioCode),
getEditorPath(ExternalEditor.VisualStudioCodeInsiders),
getEditorPath(ExternalEditor.VSCode),
getEditorPath(ExternalEditor.VSCodeInsiders),
getEditorPath(ExternalEditor.VSCodium),
getEditorPath(ExternalEditor.SublimeText),
getEditorPath(ExternalEditor.Typora),
getEditorPath(ExternalEditor.SlickEdit),
Expand All @@ -101,14 +110,15 @@ export async function getAvailableEditors(): Promise<
}

if (codePath) {
results.push({ editor: ExternalEditor.VisualStudioCode, path: codePath })
results.push({ editor: ExternalEditor.VSCode, path: codePath })
}

if (codeInsidersPath) {
results.push({
editor: ExternalEditor.VisualStudioCode,
path: codeInsidersPath,
})
results.push({ editor: ExternalEditor.VSCode, path: codeInsidersPath })
}

if (codiumPath) {
results.push({ editor: ExternalEditor.VSCodium, path: codiumPath })
}

if (sublimePath) {
Expand Down
Loading

0 comments on commit 04b940d

Please sign in to comment.