Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JULIA_EDITOR #2067

Merged
merged 2 commits into from Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions package.json
Expand Up @@ -672,6 +672,14 @@
"scope": "machine-overridable",
"description": "Number of threads to use for Julia processes."
},
"julia.editor": {
"type": [
"string",
"null"
],
"default": null,
"markdownDescription": "Command to open files from the REPL (via setting the `JULIA_EDITOR` environment variable). Defaults to `code`/`code-insiders` if unset."
},
"julia.format.indent": {
"type": "integer",
"default": 4,
Expand Down
17 changes: 9 additions & 8 deletions src/interactive/repl.ts
Expand Up @@ -40,18 +40,19 @@ function is_remote_env(): boolean {
}

function get_editor(): string {
if (is_remote_env() || process.platform === 'darwin') {
// code-server:
const editor: string | null = vscode.workspace.getConfiguration('julia').get('editor')

if (editor) {
return editor
}
if (is_remote_env()) {
if (vscode.env.appName === 'Code - OSS') {
return `"${path.join(vscode.env.appRoot, '..', '..', 'bin', 'code-server')}"`
return 'code-server'
} else {
const cmd = vscode.env.appName.includes('Insiders') && process.platform !== 'darwin' ? 'code-insiders' : 'code'
return `"${path.join(vscode.env.appRoot, 'bin', cmd)}"`
return `"${process.execPath}"`
}
}
else {
return `"${process.execPath}"`
}
return vscode.env.appName.includes('Insiders') ? 'code-insiders' : 'code'
}

async function startREPL(preserveFocus: boolean, showTerminal: boolean = true) {
Expand Down