mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:43 +00:00
Enable tab completion for ruff rule
(#7560)
## Summary
Writing `ruff rule E1`, then tab, shows:
<img width="724" alt="Screen Shot 2023-09-20 at 9 29 09 PM"
src="00297f24
-8828-4485-a00e-6af1ab4e7875">
Closes https://github.com/astral-sh/ruff/issues/2812.
This commit is contained in:
parent
ad893f8295
commit
b685ee4749
4 changed files with 63 additions and 3 deletions
|
@ -10,7 +10,7 @@ use ruff_linter::registry::Rule;
|
|||
use ruff_linter::settings::types::{
|
||||
FilePattern, PatternPrefixPair, PerFileIgnore, PreviewMode, PythonVersion, SerializationFormat,
|
||||
};
|
||||
use ruff_linter::{RuleSelector, RuleSelectorParser};
|
||||
use ruff_linter::{RuleParser, RuleSelector, RuleSelectorParser};
|
||||
use ruff_workspace::configuration::{Configuration, RuleSelection};
|
||||
use ruff_workspace::resolver::ConfigurationTransformer;
|
||||
|
||||
|
@ -39,7 +39,7 @@ pub enum Command {
|
|||
#[command(group = clap::ArgGroup::new("selector").multiple(false).required(true))]
|
||||
Rule {
|
||||
/// Rule to explain
|
||||
#[arg(value_parser=Rule::from_code, group = "selector")]
|
||||
#[arg(value_parser=RuleParser, group = "selector", hide_possible_values = true)]
|
||||
rule: Option<Rule>,
|
||||
|
||||
/// Explain all rules
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue