Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-root workspace uses the same ruff binary for all folders #706

Open
dhruvmanila opened this issue Feb 26, 2025 · 1 comment
Open

Multi-root workspace uses the same ruff binary for all folders #706

dhruvmanila opened this issue Feb 26, 2025 · 1 comment
Labels
multi-root-workspaces Related to https://code.visualstudio.com/docs/editor/workspaces/multi-root-workspaces question Asking for support or clarification

Comments

@dhruvmanila
Copy link
Member

There is something wrong with multi-root packages.

If I have the following structure :

- folder1
  -  .venv/
  - ...
  - pyproject.toml <- using ruff 0.8.x
- folder2
  -  .venv/
  - ...
  - pyproject.toml  <- using ruff 0.9.x

The extension will use folder1/.venv/bin/ruff to lint/format files in the folder2 directory, which is not want I want. Is there any way to tell it to use the ruff binary from the venv of the current folder?

FYI this is how black and mypy extensions correctly works with the fromEnvironment setting.

cc @b4stien

@dhruvmanila dhruvmanila added multi-root-workspaces Related to https://code.visualstudio.com/docs/editor/workspaces/multi-root-workspaces question Asking for support or clarification labels Feb 26, 2025
@dhruvmanila
Copy link
Member Author

Yeah, I think this is expected. We do have a couple of issues around multi-root workspaces.

To give some context, the extension utilizes the ruff server in the background to provide all the services in the editor which includes diagnostics, formatting, code actions, etc. This means that for a multi-root workspace, the extension needs to find a ruff binary that it will use to start the language server. Currently, we are limited by a single binary for the entire workspace including multi-root workspace. This logic to find the binary is same as the one in vscode-black-formatter and probably other Python extensions as well because we used the Python extension template to start with.

FYI this is how black and mypy extensions correctly works with the fromEnvironment setting.

Can you say more about this? What do you mean by "extensions correctly works with the fromEnvironment setting" ?

I'm also curious to know why are you using two separate Ruff versions in a multi-root workspace?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multi-root-workspaces Related to https://code.visualstudio.com/docs/editor/workspaces/multi-root-workspaces question Asking for support or clarification
Projects
None yet
Development

No branches or pull requests

1 participant