-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
ruff.interpreter
from workspace settings (#553)
## Summary This PR updates the scope of `ruff.interpreter` setting from `window` to `resource` in 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-formatter` extension also updated the scope of `ruff.interpreter` to be `resource` in microsoft/vscode-black-formatter@5f2fc61. fixes: #551 ## Test Plan ### Relative paths are unresolved ```json { "ruff.importStrategy": "fromEnvironment", "ruff.interpreter": [".venv/bin/python"] } ``` Logs: ``` 2024-07-24 08:50:37.182 [info] Using interpreter: .venv/bin/python 2024-07-24 08:50:39.240 [error] Unable to find any Python environment for the interpreter path: .venv/bin/python ``` Preview for the status bar: <img width="1728" alt="Screenshot 2024-07-24 at 08 51 15" src="https://github.com/user-attachments/assets/e58d2691-cd94-4e03-8ec5-bbc65d1bf46f"> ### Using VS Code specific variables ```json { "ruff.importStrategy": "fromEnvironment", "ruff.interpreter": ["${workspaceFolder}/.venv/bin/python"] } ``` Logs: ``` 2024-07-24 08:51:43.272 [info] Using interpreter: /Users/dhruv/playground/ruff/.venv/bin/python 2024-07-24 08:51:43.306 [info] Using the Ruff binary: /Users/dhruv/playground/ruff/.venv/bin/ruff 2024-07-24 08:51:43.310 [info] Resolved 'ruff.nativeServer: auto' to use the native server 2024-07-24 08:51:43.313 [info] Found Ruff 0.5.4 at /Users/dhruv/playground/ruff/.venv/bin/ruff 2024-07-24 08:51:43.313 [info] Server run command: /Users/dhruv/playground/ruff/.venv/bin/ruff server 2024-07-24 08:51:43.313 [info] Server: Start requested. ```
- Loading branch information
1 parent
9672002
commit c089b5a
Showing
5 changed files
with
60 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters