Merge #11035
11035: Include clippy lint groups in autocomplete r=Veykril a=k-nasa ## Why close: https://github.com/rust-analyzer/rust-analyzer/issues/11027 ## Proof I confirmed that complement candidates are coming out. https://user-images.githubusercontent.com/23740172/146465758-bc7d5cdd-e2fb-48d6-abf7-804ba859c9b1.mov Co-authored-by: k-nasa <htilcs1115@gmail.com>
This commit is contained in:
commit
81d0096000
@ -6,7 +6,9 @@
|
||||
|
||||
use ide_db::{
|
||||
helpers::{
|
||||
generated_lints::{CLIPPY_LINTS, DEFAULT_LINTS, FEATURES, RUSTDOC_LINTS},
|
||||
generated_lints::{
|
||||
Lint, CLIPPY_LINTS, CLIPPY_LINT_GROUPS, DEFAULT_LINTS, FEATURES, RUSTDOC_LINTS,
|
||||
},
|
||||
parse_tt_as_comma_sep_paths,
|
||||
},
|
||||
SymbolKind,
|
||||
@ -36,9 +38,17 @@ pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext)
|
||||
"feature" => lint::complete_lint(acc, ctx, &parse_tt_as_comma_sep_paths(tt)?, FEATURES),
|
||||
"allow" | "warn" | "deny" | "forbid" => {
|
||||
let existing_lints = parse_tt_as_comma_sep_paths(tt)?;
|
||||
lint::complete_lint(acc, ctx, &existing_lints, DEFAULT_LINTS);
|
||||
lint::complete_lint(acc, ctx, &existing_lints, CLIPPY_LINTS);
|
||||
lint::complete_lint(acc, ctx, &existing_lints, RUSTDOC_LINTS);
|
||||
|
||||
let lints: Vec<Lint> = CLIPPY_LINT_GROUPS
|
||||
.iter()
|
||||
.map(|g| &g.lint)
|
||||
.chain(DEFAULT_LINTS.iter())
|
||||
.chain(CLIPPY_LINTS.iter())
|
||||
.chain(RUSTDOC_LINTS)
|
||||
.cloned()
|
||||
.collect();
|
||||
|
||||
lint::complete_lint(acc, ctx, &existing_lints, &lints);
|
||||
}
|
||||
"cfg" => {
|
||||
cfg::complete_cfg(acc, ctx);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -18,6 +18,7 @@ fn sourcegen_lint_completions() {
|
||||
|
||||
let mut contents = String::from(
|
||||
r"
|
||||
#[derive(Clone)]
|
||||
pub struct Lint {
|
||||
pub label: &'static str,
|
||||
pub description: &'static str,
|
||||
|
Loading…
x
Reference in New Issue
Block a user