-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uses actual exec path as editor command
- Loading branch information
Showing
4 changed files
with
39 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function getExecPath(): string { | ||
throw new Error('Cannot get exec path from webview context'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { resolve } from 'path'; | ||
import { env } from 'vscode'; | ||
import { getPlatform } from './platform'; | ||
|
||
export function getExecPath(): string { | ||
if (env.appHost !== 'desktop') { | ||
throw new Error('Cannot get exec path for not desktop runtime'); | ||
} | ||
switch (getPlatform()) { | ||
case 'windows': | ||
// tested with vscode portable (from zip) https://code.visualstudio.com/docs/editor/portable#_enable-portable-mode | ||
return resolve(env.appRoot, '../../bin/code').replace(/\\/g, '/'); | ||
case 'linux': | ||
return resolve(env.appRoot, '../../bin/code'); | ||
case 'macOS': | ||
return resolve(env.appRoot, 'bin/code'); | ||
default: | ||
break; | ||
} | ||
switch (env.appName) { | ||
case 'Visual Studio Code - Insiders': | ||
return 'code-insiders'; | ||
case 'Visual Studio Code - Exploration': | ||
return 'code-exploration'; | ||
case 'VSCodium': | ||
return 'codium'; | ||
case 'Cursor': | ||
return 'cursor'; | ||
default: | ||
return 'code'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters