aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion')
-rw-r--r--crates/ide_completion/src/completions/attribute/cfg.rs18
1 files changed, 2 insertions, 16 deletions
diff --git a/crates/ide_completion/src/completions/attribute/cfg.rs b/crates/ide_completion/src/completions/attribute/cfg.rs
index 71e659563..847e6529a 100644
--- a/crates/ide_completion/src/completions/attribute/cfg.rs
+++ b/crates/ide_completion/src/completions/attribute/cfg.rs
@@ -26,20 +26,6 @@ pub(crate) fn complete_cfg(acc: &mut Completions, ctx: &CompletionContext) {
26 .find(|t| matches!(t.kind(), SyntaxKind::IDENT)); 26 .find(|t| matches!(t.kind(), SyntaxKind::IDENT));
27 27
28 match previous.as_ref().map(|p| p.text()) { 28 match previous.as_ref().map(|p| p.text()) {
29 Some("feature") => {
30 ctx.krate.map(|krate| {
31 krate.features(ctx.db).iter().for_each(|f| {
32 let mut item = CompletionItem::new(
33 CompletionKind::Attribute,
34 ctx.source_range(),
35 f.clone(),
36 );
37 item.insert_text(format!(r#""{}""#, f));
38
39 acc.add(item.build())
40 })
41 });
42 }
43 Some("target_arch") => KNOWN_ARCH.iter().for_each(add_completion), 29 Some("target_arch") => KNOWN_ARCH.iter().for_each(add_completion),
44 Some("target_env") => KNOWN_ENV.iter().for_each(add_completion), 30 Some("target_env") => KNOWN_ENV.iter().for_each(add_completion),
45 Some("target_os") => KNOWN_OS.iter().for_each(add_completion), 31 Some("target_os") => KNOWN_OS.iter().for_each(add_completion),
@@ -47,7 +33,7 @@ pub(crate) fn complete_cfg(acc: &mut Completions, ctx: &CompletionContext) {
47 Some("target_endian") => ["little", "big"].iter().for_each(add_completion), 33 Some("target_endian") => ["little", "big"].iter().for_each(add_completion),
48 Some(name) => { 34 Some(name) => {
49 ctx.krate.map(|krate| { 35 ctx.krate.map(|krate| {
50 krate.cfg(ctx.db).get_cfg_values(&name).iter().for_each(|s| { 36 krate.potential_cfg(ctx.db).get_cfg_values(&name).iter().for_each(|s| {
51 let mut item = CompletionItem::new( 37 let mut item = CompletionItem::new(
52 CompletionKind::Attribute, 38 CompletionKind::Attribute,
53 ctx.source_range(), 39 ctx.source_range(),
@@ -61,7 +47,7 @@ pub(crate) fn complete_cfg(acc: &mut Completions, ctx: &CompletionContext) {
61 } 47 }
62 None => { 48 None => {
63 ctx.krate.map(|krate| { 49 ctx.krate.map(|krate| {
64 krate.cfg(ctx.db).get_cfg_keys().iter().for_each(|s| { 50 krate.potential_cfg(ctx.db).get_cfg_keys().iter().for_each(|s| {
65 let item = CompletionItem::new( 51 let item = CompletionItem::new(
66 CompletionKind::Attribute, 52 CompletionKind::Attribute,
67 ctx.source_range(), 53 ctx.source_range(),