-
Notifications
You must be signed in to change notification settings - Fork 23
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
Avoiding passing pyproject.toml
options as command-line arguments
#2
Comments
\cc @jhossbach |
I'd rather go with (1), it feels cleaner to let Shouldn't the configuration hierarchy be project config > pylsp config? Say e.g. you disagree with the default line length of 88, so instead you configure your lsp via neovim to be 100 by default. If you now work in a project with a We could add some logic to use the user-configured options only if the |
Yeah I think you're right that project configuration should take precedence. I don't really have a great answer for how we should enable "defaults" in those other cases. 🤔 |
This should work: for key, value in toml_config.items():
if key in [
"exclude",
"ignore",
"line-length",
"per-file-ignores",
"select",
]:
settings[key] = value It will skip any entries in the |
Ruff is likely to support extending pyproject files (i.e., you could point to another pyproject file, and it’ll automatically merge in its settings). Which could make this hard to maintain, since you’d miss extended properties (or have to resolve the extension). I think the safest thing to do would be: look for a pyproject.toml in all ancestor directories of the file. If we find one, don’t apply any of the LSP settings as command-line arguments (defer to Ruff). If we don’t, then apply the LSP settings as command-line arguments. What do you think? |
I think this makes sense. In case I was working in a project with some configuration for ruff, I would expect that the default for ruff should still apply even if the option is not specified, so even if e.g. line-length was not explicitly set to 88 it would still apply within the project. I will create a PR for this. |
Awesome, happy to review! |
See discussion in #1.
The text was updated successfully, but these errors were encountered: