Skip to content

Commit

Permalink
VS Code: add hint about setting ruff.importStrategy=fromEnvironment
Browse files Browse the repository at this point in the history
See also discussion in Ruff issue:
astral-sh/ruff#282 (comment)
  • Loading branch information
gertvdijk committed Feb 23, 2023
1 parent 41a0311 commit 2ddc2f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
// Please set 'ruff.importStrategy' to 'fromEnvironment' in your workspace (or user)
// settings to use the same Ruff version as in the virtual environment. The Ruff
// plugin uses the bundled version by default.
// Not a valid folder-level setting.
// "ruff.importStrategy": "fromEnvironment"

"files.associations": {
".dockerignore": "ignore", // auto-interprets wrongly as Python somehow
},
Expand Down
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ for code style (e.g. 88-chars ruler), provides a task with 'problemMatcher' to r
In order for them to work correctly, please
[select the Python interpreter][ms-vscode-select-python] of the virtualenv you created,
e.g. `.direnv/python-3.10.9/bin/python`.
The linters and type checker will then be run inside this environment created with

Please set `ruff.importStrategy` to `fromEnvironment` in your workspace (or user)
settings to use the same Ruff version as in the virtual environment.
The Ruff plugin uses the bundled version by default.

All linters and type checkers will run inside this environment created with
specific versions specified rather than relying on whatever is available system-wide.

ℹ️ If you like, enable automatic on-save formatting with project-provided settings using
Expand Down

0 comments on commit 2ddc2f3

Please sign in to comment.