diff --git a/package.json b/package.json index ecc33854217f..3307ab32c2ed 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ }, { "command": "python.setInterpreter", - "title": "Select Workspace Interpreter", + "title": "Select Interpreter", "category": "Python" }, { diff --git a/src/client/interpreter/index.ts b/src/client/interpreter/index.ts index 447946d7871c..d2eb6fd9e71d 100644 --- a/src/client/interpreter/index.ts +++ b/src/client/interpreter/index.ts @@ -58,7 +58,11 @@ export class InterpreterManager implements Disposable { pythonPath = path.join('${workspaceRoot}', path.relative(workspace.rootPath!, pythonPath)); } const pythonConfig = workspace.getConfiguration('python'); - pythonConfig.update('pythonPath', pythonPath).then(() => { + let global = null; + if (typeof workspace.rootPath !== 'string') { + global = true; + } + pythonConfig.update('pythonPath', pythonPath, global).then(() => { //Done }, reason => { window.showErrorMessage(`Failed to set 'pythonPath'. Error: ${reason.message}`); diff --git a/src/client/providers/setInterpreterProvider.ts b/src/client/providers/setInterpreterProvider.ts index 6021a71be60f..3eb44c640065 100644 --- a/src/client/providers/setInterpreterProvider.ts +++ b/src/client/providers/setInterpreterProvider.ts @@ -58,9 +58,6 @@ export class SetInterpreterProvider implements vscode.Disposable { } private setInterpreter() { - if (typeof vscode.workspace.rootPath !== 'string') { - return vscode.window.showErrorMessage('Please open a workspace to select the Python Interpreter'); - } this.presentQuickPick(); } } \ No newline at end of file