From 238b52358d0d6109c89d1288b12bfa0aa71790de Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 22 Dec 2018 02:02:47 +0300 Subject: more icons --- crates/ra_lsp_server/src/conv.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'crates/ra_lsp_server') diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs index 973e0915e..6f770ec69 100644 --- a/crates/ra_lsp_server/src/conv.rs +++ b/crates/ra_lsp_server/src/conv.rs @@ -2,7 +2,7 @@ use languageserver_types::{ self, Location, Position, Range, SymbolKind, TextDocumentEdit, TextDocumentIdentifier, TextDocumentItem, TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier, InsertTextFormat, }; -use ra_analysis::{FileId, FileSystemEdit, SourceChange, SourceFileEdit, FilePosition, CompletionItem, InsertText}; +use ra_analysis::{FileId, FileSystemEdit, SourceChange, SourceFileEdit, FilePosition, CompletionItem, CompletionItemKind, InsertText}; use ra_editor::{LineCol, LineIndex}; use ra_text_edit::{AtomTextEdit, TextEdit}; use ra_syntax::{SyntaxKind, TextRange, TextUnit}; @@ -45,6 +45,18 @@ impl Conv for SyntaxKind { } } +impl Conv for CompletionItemKind { + type Output = ::languageserver_types::CompletionItemKind; + + fn conv(self) -> ::Output { + use ::languageserver_types::CompletionItemKind::*; + match self { + CompletionItemKind::Keyword => Keyword, + CompletionItemKind::Snippet => Snippet, + } + } +} + impl Conv for CompletionItem { type Output = ::languageserver_types::CompletionItem; @@ -52,6 +64,7 @@ impl Conv for CompletionItem { let mut res = ::languageserver_types::CompletionItem { label: self.label().to_string(), filter_text: Some(self.lookup().to_string()), + kind: self.kind().map(|it| it.conv()), ..Default::default() }; match self.insert_text() { -- cgit v1.2.3