Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Removing dependency on pythonPath setting #384

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
}
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
},
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"publisher": "__PUBLISHER__",
"instrumentationKey": "__AIKEY__",
"icon": "assets/icon.png",
"featureFlags": {
"usingNewPythonInterpreterPathApi": true
},
"engines": {
"vscode": "^1.43.0"
},
Expand Down
15 changes: 14 additions & 1 deletion src/service/setupService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,20 @@ export class SetupService {
: GLOBAL_ENV_VARS.PYTHON;
// try to get name from interpreter
try {
originalPythonExecutablePath = getConfig(CONFIG.PYTHON_PATH);
const extension = vscode.extensions.getExtension("ms-python.python");
const usingNewInterpreterStorage = extension.packageJSON?.featureFlags?.usingNewInterpreterStorage;
if (usingNewInterpreterStorage) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment explaining that the python extension is deprecating the old path? As we are still falling back to it if the new interpreter storage is not set

if (!extension.isActive) {
await extension.activate();
}
const execCommand = extension.exports.settings.getExecutionDetails ?
extension.exports.settings.getExecutionDetails().execCommand :
extension.exports.settings.getExecutionCommand();
originalPythonExecutablePath = execCommand.join(" ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
originalPythonExecutablePath = execCommand.join(" ");
originalPythonExecutablePath = execCommand.join(" ");

nit: extra tab 😁

}
else {
originalPythonExecutablePath = getConfig(CONFIG.PYTHON_PATH);
}
} catch (err) {
originalPythonExecutablePath = systemPythonVar;
}
Expand Down