diff options
Diffstat (limited to 'crates/server/src')
-rw-r--r-- | crates/server/src/main_loop/handlers.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/crates/server/src/main_loop/handlers.rs b/crates/server/src/main_loop/handlers.rs index 92ffb30c3..3ee0873f4 100644 --- a/crates/server/src/main_loop/handlers.rs +++ b/crates/server/src/main_loop/handlers.rs | |||
@@ -4,7 +4,7 @@ use languageserver_types::{ | |||
4 | Diagnostic, DiagnosticSeverity, Url, DocumentSymbol, | 4 | Diagnostic, DiagnosticSeverity, Url, DocumentSymbol, |
5 | Command, TextDocumentIdentifier, WorkspaceEdit, | 5 | Command, TextDocumentIdentifier, WorkspaceEdit, |
6 | SymbolInformation, Position, Location, TextEdit, | 6 | SymbolInformation, Position, Location, TextEdit, |
7 | CompletionItem, | 7 | CompletionItem, InsertTextFormat, CompletionItemKind, |
8 | }; | 8 | }; |
9 | use serde_json::{to_value, from_value}; | 9 | use serde_json::{to_value, from_value}; |
10 | use url_serde; | 10 | use url_serde; |
@@ -331,9 +331,17 @@ pub fn handle_completion( | |||
331 | Some(items) => items, | 331 | Some(items) => items, |
332 | }; | 332 | }; |
333 | let items = items.into_iter() | 333 | let items = items.into_iter() |
334 | .map(|item| CompletionItem { | 334 | .map(|item| { |
335 | label: item.name, | 335 | let mut res = CompletionItem { |
336 | .. Default::default() | 336 | label: item.name, |
337 | .. Default::default() | ||
338 | }; | ||
339 | if let Some(snip) = item.snippet { | ||
340 | res.insert_text = Some(snip); | ||
341 | res.insert_text_format = Some(InsertTextFormat::Snippet); | ||
342 | res.kind = Some(CompletionItemKind::Keyword); | ||
343 | }; | ||
344 | res | ||
337 | }) | 345 | }) |
338 | .collect(); | 346 | .collect(); |
339 | 347 | ||