diff options
author | Aleksey Kladov <[email protected]> | 2018-08-28 19:11:17 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-28 19:11:17 +0100 |
commit | 2257c08cb159a30492bf2aec172539b1dd504700 (patch) | |
tree | 3346d52224b9444e975314e1af32f4490baf91c2 /crates/server/src | |
parent | b00a4d43ecd4af49a2870718a9d5b8d49084a285 (diff) |
Add ret type
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 | ||