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

Improved interpreter switching #1263

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
},
{
"command": "python.setInterpreter",
"title": "Select Workspace Interpreter",
"title": "Select Interpreter",
"category": "Python"
},
{
Expand Down
6 changes: 5 additions & 1 deletion src/client/interpreter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down
3 changes: 0 additions & 3 deletions src/client/providers/setInterpreterProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}