mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-01 07:48:45 +00:00
Auto merge of #12642 - weirdsmiley:master, r=Veykril
fix: deduplicate cfg completions cfg completions are duplicated if they are set with multiple values. This patch deduplicates them. fixes: [#12623](https://github.com/rust-lang/rust-analyzer/issues/12623)
This commit is contained in:
commit
f6c0bf8f09
1 changed files with 2 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
use ide_db::SymbolKind;
|
use ide_db::SymbolKind;
|
||||||
|
use itertools::Itertools;
|
||||||
use syntax::SyntaxKind;
|
use syntax::SyntaxKind;
|
||||||
|
|
||||||
use crate::{completions::Completions, context::CompletionContext, CompletionItem};
|
use crate::{completions::Completions, context::CompletionContext, CompletionItem};
|
||||||
|
@ -34,7 +35,7 @@ pub(crate) fn complete_cfg(acc: &mut Completions, ctx: &CompletionContext) {
|
||||||
|
|
||||||
acc.add(item.build());
|
acc.add(item.build());
|
||||||
}),
|
}),
|
||||||
None => ctx.krate.potential_cfg(ctx.db).get_cfg_keys().cloned().for_each(|s| {
|
None => ctx.krate.potential_cfg(ctx.db).get_cfg_keys().cloned().unique().for_each(|s| {
|
||||||
let item = CompletionItem::new(SymbolKind::BuiltinAttr, ctx.source_range(), s);
|
let item = CompletionItem::new(SymbolKind::BuiltinAttr, ctx.source_range(), s);
|
||||||
acc.add(item.build());
|
acc.add(item.build());
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in a new issue