diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion/presentation.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/presentation.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index 301c878b1..5cabe9a32 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs | |||
@@ -108,17 +108,22 @@ impl Completions { | |||
108 | let ast_node = macro_.source(ctx.db).ast; | 108 | let ast_node = macro_.source(ctx.db).ast; |
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 | let code_declaration = name + "!"; | 111 | |
112 | let macro_braces_to_insert = match name.as_str() { | ||
113 | "vec" => "[$0]", | ||
114 | _ => "($0)", | ||
115 | }; | ||
116 | let macro_declaration = name + "!"; | ||
112 | 117 | ||
113 | let builder = CompletionItem::new( | 118 | let builder = CompletionItem::new( |
114 | CompletionKind::Reference, | 119 | CompletionKind::Reference, |
115 | ctx.source_range(), | 120 | ctx.source_range(), |
116 | &code_declaration, | 121 | ¯o_declaration, |
117 | ) | 122 | ) |
118 | .kind(CompletionItemKind::Macro) | 123 | .kind(CompletionItemKind::Macro) |
119 | .set_documentation(macro_.docs(ctx.db)) | 124 | .set_documentation(macro_.docs(ctx.db)) |
120 | .detail(detail) | 125 | .detail(detail) |
121 | .insert_snippet(format!("{}($0)", &code_declaration)); | 126 | .insert_snippet(macro_declaration + macro_braces_to_insert); |
122 | 127 | ||
123 | self.add(builder); | 128 | self.add(builder); |
124 | } | 129 | } |