astral-sh / ruff

An extremely fast Python linter and code formatter, written in Rust.
https://docs.astral.sh/ruff
MIT License
32.37k stars 1.08k forks source link

Tab-autocomplete `ruff config` #4551

Open janosh opened 1 year ago

janosh commented 1 year ago

Would be great if ruff config tab autocompletes:

ruff config is
# tab
ruff config isort

and

ruff config isort.spl
# tab
ruff config isort.split-on-trailing-comma

Related: https://github.com/charliermarsh/ruff/issues/2808 hence pinging @not-my-profile

MichalKacprzak99 commented 10 months ago

@charliermarsh Hi, I would like to work on this, can you assign it to me?

charliermarsh commented 10 months ago

You got it!

dhruvmanila commented 8 months ago

@MichalKacprzak99 Not in a hurry but just wondering if you've started working on this? Feel free to ask any questions if you're stuck :)

hesampakdaman commented 4 months ago

I looked at this issue a little bit during the weekend. I initially tried to create a derived macro for Options that creates an enum that I then implement clap::ValueEnum for. However, this approach is not viable because Rust doesn't support reflection, and I couldn't generate the enum variants for attributes #[option_group] recursively.

My only other idea is to create a huge enum by hand, but that would be a rather big code change.