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

ruff.path should be scoped to a window instead of resource #550

Open
dhruvmanila opened this issue Jul 23, 2024 · 5 comments
Open

ruff.path should be scoped to a window instead of resource #550

dhruvmanila opened this issue Jul 23, 2024 · 5 comments
Labels
configuration Related to settings and configuration

Comments

@dhruvmanila
Copy link
Member

The ruff.path config is scoped to a "resource" which means that in a multi-root workspace, one can configure this setting on a per-directory basis.

This was ok with ruff-lsp because it would use this executable for every invocation of linting / formatting. But, with the native server, it's only used to start the server which would happen on a workspace level.

This might be a breaking change for users who've configured ruff.path for each folder in a single workspace.

We should change this when we deprecate ruff-lsp.

@dhruvmanila
Copy link
Member Author

But, it seems that you can have different virtual environments for each folder in a workspace. This means one cannot configure to use different Ruff version for each folder in a workspace. For this to even be supported, it'll require us to start different server instance for individual folders in a workspace.

@dhruvmanila dhruvmanila added the configuration Related to settings and configuration label Jul 23, 2024
@kkpattern
Copy link

Currently, ruff-vscode seems doesn't recognize the virtual environment in a multi-root workspace environment. The vscode shows a python virtual environment is activated, but ruff-vscode still says "Python interpreter missing".

@dhruvmanila
Copy link
Member Author

@kkpattern can you say more about your issue and how does that relate to this one? Are all workspaces in the multi-root workspace related to Python or are there any that are of other language?

@kkpattern
Copy link

I created a demo repo for this: https://github.com/kkpattern/ruff-vscode-multi-root. I have two different projects in this repository, each with a different Python virtual environment. With the multi-root workspace feature, when editing project1/main.py and project2/main.py, the corresponding .venv1 and .venv2 are activated accordingly. But the ruff-vscode seems not to recognize the virtual environments. According to the log, it still uses the system Python interpreter.

@dhruvmanila
Copy link
Member Author

I think that's probably unrelated to the issue here and might be another issue. Looking at the repository, the first folder in the workspace seems to be the root folder and it could be that the root folder doesn't have a corresponding Python interpreter selected in VS Code. I'm not sure, I might need more information to understand what's happening here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Related to settings and configuration
Projects
None yet
Development

No branches or pull requests

2 participants