-
Notifications
You must be signed in to change notification settings - Fork 297
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
Change how to fetch pythonPath
as we're deprecating python.pythonPath
setting soon
#604
Comments
We've to make sure all these 4 cases work,
Proposed changesCode runner In the new version of code runner, We would check if user is using the old or the new python extension using the new setting.
Python extension
How to check from extension A if user is using the old version of extension B or the new one Introduce a flag in Python extension
"featureFlags": {
"usingNewInterpreterStorage": true
} So you can access the flag using, const extension = vscode.extensions.getExtension('ms-python.python')!;
const flagValue = extension.packageJSON.featureFlags.usingNewInterpreterStorage; Code runner Please add a similar flag in const extension = vscode.extensions.getExtension('ms-python.python')!;
if (!extension.isActive) {
await extension.activate();
}
const pythonPath = extension.exports.settings.getExecutionCommand(resource).join(' '); Note we will have to release Code runnner extension first, followed by the extension release. (which is targeted before May 12) |
Thanks @karrtikr for your proposed changes. It looks great! |
For the flag, I plan to use below name in Code Runner: "featureFlags": {
"usingNewPythonInterpreterPathApi": true
} |
Hey @formulahendry 👋 Here's a sample code using const extension = vscode.extensions.getExtension('ms-python.python')!;
if (!extension.isActive) {
await extension.activate();
}
const pythonPath = extension.exports.settings.getExecutionCommand(resource).join(' '); Also I realized that we should not put quotes around boolean "featureFlags": {
"usingNewPythonInterpreterPathApi": true
} I've updated the Proposed changes comment to reflect these details as well. We're having a discussion on the design of the API, I'll let you know when we finalize it, cheers! |
For case 4, to reduce the number of users that get this prompt. Can we only show the prompt to those who have the setting in code runner to use It would be helpful if you could please provide a code snippet of how to accomplish that, which setting to check etc. |
We finalized the API, it's detailed in the issue description microsoft/vscode-python#11294. Please let me know if you've any questions. |
Hi @karrtikr const pythonExecutor = vscode.workspace.getConfiguration("code-runner", resource).get<string>("executorMap.python");
const isUsingPythonPath: boolean = pythonExecutor.includes("$pythonPath"); |
I see the PR is merged. |
Thanks for the snippet, will let you know. |
It's available in the Insiders now. |
@formulahendry Please let me know after you're able to make the release with the changes, after which I can merge microsoft/vscode-python#11395. |
Sure! I will work on this and let you know! |
Hi @karrtikr , I have just committed the changes. If the changes are OK for you, I will publish a new release. |
Yep, all good from my side. I have a comment regarding your change 437456d#r38877025 Thanks again & let me know when it's available in the marketplace after which I'll merge my PR. |
Hi @karrtikr , I have just published a new release. You could continue your work now. 😄 |
Hi Python extension dev here👋
We will soon be deprecating
python.pythonPath
settings which you guys use here https://github.com/formulahendry/vscode-code-runner/blob/master/src/codeManager.ts#L363.We're moving it out of settings to a VSCode storage. So you'll have to change the code to fetch interpreter path from a API we provide instead of fetching using
settings.json
, in a way that it's backwards compatible. The initial design of the API is listed here microsoft/vscode-python#11294The text was updated successfully, but these errors were encountered: