Open CodeTex opened 1 month ago
Hey, thanks for the detailed report.
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?
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?