Use ruff.interpreter from workspace settings#553
Conversation
6b70a82 to
78dd0ae
Compare
| traceLog(`Python extension loaded`); | ||
| return; // The `onDidChangePythonInterpreter` event will trigger the server start. | ||
| } | ||
| } else { | ||
| await runServer(); | ||
| } | ||
| await runServer(); | ||
| }); |
There was a problem hiding this comment.
This was a bug that would hang the extension when ruff.interpreter is provided and the workspace is trusted. We would never call the runServer in that case.
7e25f69 to
dec965c
Compare
Do we need to fall back to the interpreter from the Python extension? |
We do fall back to that, it's just moved to |
dec965c to
1555057
Compare
Summary
This PR updates the scope of
ruff.interpretersetting fromwindowtoresourcein order to resolve the variables such as${workspaceFolder}if present.In #551, what happens is that the Python extension fails to resolve the environment corresponding to that interpreter which causes the hang. The bug present in #551 was there for a very long time but it got visible because of e665ec7. Before that commit, the extension would just move ahead and use the interpreter from the Python extension but now we explicitly stop moving ahead if it fails to resolve the environment corresponding to the interpreter.
For reference, the
vscode-black-formatterextension also updated the scope ofruff.interpreterto beresourcein microsoft/vscode-black-formatter@5f2fc61.fixes: #551
Test Plan
Relative paths are unresolved
{ "ruff.importStrategy": "fromEnvironment", "ruff.interpreter": [".venv/bin/python"] }Logs:
Preview for the status bar:
Using VS Code specific variables
{ "ruff.importStrategy": "fromEnvironment", "ruff.interpreter": ["${workspaceFolder}/.venv/bin/python"] }Logs: