-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Implement tab autocomplete for ruff config
#15603
base: main
Are you sure you want to change the base?
Implement tab autocomplete for ruff config
#15603
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emit the full first paragraph for completion doc
updates:
|
Are you referring to the header like $ ruff config lint.ruff
parenthesize-tuple-in-subscript
extend-markup-names
allowed-markup-calls |
Thanks for providing your thoughts on this. I agree that it might be quicker for a user to get to a specific config key if we skip the plugin header but those are the possible values that can be passed to the |
I think it's fine to ignore tables as long as we ignore all table entries because you can't set the table itself (I guess you can, but it's somewhat useless). |
I see, I'm not sure if that kind of heuristics exists, maybe it does within the OptionsMetadata? Regardless, I'm not sure I follow what you mean by "you can't set the table itself" as, from what I understand, |
#[cfg(feature = "clap")] | ||
pub mod clap_completion { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for having a nested module within the module itself? Should we instead rename this file to completion.rs
instead? This will involve updating the lib.rs
and args.rs
to use the correct name as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, yes, my bad. I originally copied the inner module from RuleSelector, but you are totally right this doesn't make sense here as there is nothing else in the module. I'll fix that alongside the OptionsSet completions as soon as we'll align on what we are doing
@MichaReiser as per my logic above - when an OptionSet has some documentation, it is kinda helpful to see it among completions...but tbh only when the set is small and this option even fits on the screen. So there are two viable alternatives to resolve this:
I'll follow your lead folks, let me know. |
Summary
Not the most important feature, but hey... was marked as the good first issue ;-) fixes #4551
Unfortunately, looks like clap only generates proper completions for zsh, so this would not make any difference for bash/fish.
Test Plan
Run all tests & checks per CONTRIBUTING.md and also did a manual test by sourcing
target/debug/ruff generate-shell-completion zsh