Skip to content

Commit 20fa8ab

Browse files
authored
Merge pull request #21131 from Veykril/push-rxrmsylwoowm
completions: Fix completions disregarding snippet capabilities
2 parents 5c82106 + b0d1c9a commit 20fa8ab

File tree

1 file changed

+8
-3
lines changed
  • src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute

1 file changed

+8
-3
lines changed

src/tools/rust-analyzer/crates/ide-completion/src/completions/attribute/cfg.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,14 @@ pub(crate) fn complete_cfg(acc: &mut Completions, ctx: &CompletionContext<'_>) {
5959
.into_iter()
6060
.map(|x| match x {
6161
hir::CfgAtom::Flag(key) => (key.as_str(), "".into()),
62-
hir::CfgAtom::KeyValue { key, .. } => {
63-
(key.as_str(), SmolStr::from_iter([key.as_str(), " = $0"]))
64-
}
62+
hir::CfgAtom::KeyValue { key, .. } => (
63+
key.as_str(),
64+
if ctx.config.snippet_cap.is_some() {
65+
SmolStr::from_iter([key.as_str(), " = $0"])
66+
} else {
67+
SmolStr::default()
68+
},
69+
),
6570
})
6671
.chain(CFG_CONDITION.iter().map(|&(k, snip)| (k, SmolStr::new_static(snip))))
6772
.unique_by(|&(s, _)| s)

0 commit comments

Comments
 (0)