aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion/presentation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/completion/presentation.rs')
-rw-r--r--crates/ra_ide_api/src/completion/presentation.rs21
1 files changed, 15 insertions, 6 deletions
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs
index 1b706bb13..5cabe9a32 100644
--- a/crates/ra_ide_api/src/completion/presentation.rs
+++ b/crates/ra_ide_api/src/completion/presentation.rs
@@ -109,12 +109,21 @@ impl Completions {
109 if let Some(name) = name { 109 if let Some(name) = name {
110 let detail = macro_label(&ast_node); 110 let detail = macro_label(&ast_node);
111 111
112 let builder = 112 let macro_braces_to_insert = match name.as_str() {
113 CompletionItem::new(CompletionKind::Reference, ctx.source_range(), name.clone()) 113 "vec" => "[$0]",
114 .kind(CompletionItemKind::Macro) 114 _ => "($0)",
115 .set_documentation(macro_.docs(ctx.db)) 115 };
116 .detail(detail) 116 let macro_declaration = name + "!";
117 .insert_snippet(format!("{}!", name)); 117
118 let builder = CompletionItem::new(
119 CompletionKind::Reference,
120 ctx.source_range(),
121 &macro_declaration,
122 )
123 .kind(CompletionItemKind::Macro)
124 .set_documentation(macro_.docs(ctx.db))
125 .detail(detail)
126 .insert_snippet(macro_declaration + macro_braces_to_insert);
118 127
119 self.add(builder); 128 self.add(builder);
120 } 129 }