You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When operating in a multi-root workspace with the ruff-vscode extension installed, the extension does not adhere to the required-version configuration specified in pyproject.toml for selecting the Ruff version. Despite configuring a specific Ruff version (e.g., 0.5.4) that differs from the bundled version (0.5.3) with the extension, and setting ruff.importStrategy to "fromEnvironment", the extension defaults to using the bundled Ruff executable. This behavior prevents the application of project-specific Ruff configurations defined in pyproject.toml.
Steps to Reproduce
Install ruff-vscode extension version 2024.34.0, which comes bundled with Ruff v0.5.3.
In a multi-root workspace, configure a project with pyproject.toml to require Ruff version 0.5.4 (available in the project's virtual environment).
Set ruff.importStrategy to "fromEnvironment" in the workspace settings.
Run with I rule set, with lines-after-imports set to 2, on a sample file like:
The extension should respect the required-version configuration in pyproject.toml and use the Ruff version from the environment that matches this requirement, allowing for project-specific configurations to be applied. Resulting in the sample file to:
The extension defaults to using the bundled Ruff version (0.5.3), disregarding the required-version configuration in pyproject.toml and the ruff.importStrategy setting. Resulting in sample file:
This issue does not occur in single-root workspaces; the extension correctly uses the environment's Ruff version that matches the required-version specified in pyproject.toml (the one from the venv).
Setting the required-version to the bundled version (0.5.3) allows the extension to read the pyproject.toml configurations, but this is not a viable workaround for projects requiring a different Ruff version.
Is there maybe another way to have the extension pick the ruff version as defined in every root's pyproject.toml or am I shooting for something not intended here?
The text was updated successfully, but these errors were encountered:
What I understand here is that you want to configure the extension to use a specific Ruff version. This cannot be configured via the config files because the VS Code extension is completely independent to the ruff executable. What I mean is that the extension does not read any config files as it is Ruff's responsibility to do so.
Now, before I proceed can you verify your use-case? Is it only to update the lines-after-imports value for different folder in your workspace or is it to use different Ruff version for the folders in your workspace or both?
I think this may be the same issue raised in #654, that in a multi-root workspace, the extension does use the ruff executable from the desired root's environment (presumably the first root).
Description
When operating in a multi-root workspace with the
ruff-vscode
extension installed, the extension does not adhere to therequired-version
configuration specified inpyproject.toml
for selecting the Ruff version. Despite configuring a specific Ruff version (e.g.,0.5.4
) that differs from the bundled version (0.5.3
) with the extension, and settingruff.importStrategy
to"fromEnvironment"
, the extension defaults to using the bundled Ruff executable. This behavior prevents the application of project-specific Ruff configurations defined inpyproject.toml
.Steps to Reproduce
ruff-vscode
extension version2024.34.0
, which comes bundled with Ruffv0.5.3
.pyproject.toml
to require Ruff version0.5.4
(available in the project's virtual environment).ruff.importStrategy
to"fromEnvironment"
in the workspace settings.I
rule set, with lines-after-imports set to 2, on a sample file like:Expected Behavior
The extension should respect the
required-version
configuration inpyproject.toml
and use the Ruff version from the environment that matches this requirement, allowing for project-specific configurations to be applied. Resulting in the sample file to:Actual Behavior
The extension defaults to using the bundled Ruff version (
0.5.3
), disregarding therequired-version
configuration inpyproject.toml
and theruff.importStrategy
setting. Resulting in sample file:Additional Context
required-version
specified inpyproject.toml
(the one from the venv).required-version
to the bundled version (0.5.3
) allows the extension to read thepyproject.toml
configurations, but this is not a viable workaround for projects requiring a different Ruff version.Is there maybe another way to have the extension pick the ruff version as defined in every root's pyproject.toml or am I shooting for something not intended here?
The text was updated successfully, but these errors were encountered: