Open noahw3 opened 1 day ago
Thanks for the report. I think I know why this might be happening.
This was introduced in https://github.com/astral-sh/ruff/pull/13326 as the server will always include files that has the Python language id even though it's excluded by way of not including it. Sorry for this, it's a mistake on my end.
Hmm, I think there are two arguments here:
ruff-lsp
works. This is probably the natural behavior of how a language server should consider an open file in the editor.The behavior as mentioned in (1) is also how other extensions like black work.
Would it make sense to add a configuration parameter of some sort to choose whether to include all python language id files or to strictly follow the configured include set? I'm fine with the current behavior being the default if that more closely matches the expectations for VSCode extensions, but I'd still like the ability to somehow only use the strict inclusion set.
I have ruff configured to only run against a certain directory and ignore all others. I've done this via setting the
include
value inpyproject.toml
:This works correctly when I run
ruff format
from the command line - only files in that directory are changed. However, when I save a file in VSCode that should be excluded, formatting is applied.VSCode
settings.json
:I swear I had this working a couple weeks ago, so I'm not sure if some sort of regression was introduced recently or if I somehow didn't test it correctly previously. If I explicitly add other directories to the
exclude
configuration it works, but that's obviously not as flexible as being able to only include a single directory. VSCode extension version isv2024.50.0
, ruff version is0.6.6
.