From 2257c08cb159a30492bf2aec172539b1dd504700 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 28 Aug 2018 21:11:17 +0300 Subject: Add ret type --- crates/server/src/main_loop/handlers.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'crates/server/src/main_loop') 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::{ Diagnostic, DiagnosticSeverity, Url, DocumentSymbol, Command, TextDocumentIdentifier, WorkspaceEdit, SymbolInformation, Position, Location, TextEdit, - CompletionItem, + CompletionItem, InsertTextFormat, CompletionItemKind, }; use serde_json::{to_value, from_value}; use url_serde; @@ -331,9 +331,17 @@ pub fn handle_completion( Some(items) => items, }; let items = items.into_iter() - .map(|item| CompletionItem { - label: item.name, - .. Default::default() + .map(|item| { + let mut res = CompletionItem { + label: item.name, + .. Default::default() + }; + if let Some(snip) = item.snippet { + res.insert_text = Some(snip); + res.insert_text_format = Some(InsertTextFormat::Snippet); + res.kind = Some(CompletionItemKind::Keyword); + }; + res }) .collect(); -- cgit v1.2.3