more icons

This commit is contained in:
Aleksey Kladov 2018-12-22 02:02:47 +03:00
parent f1f2804c71
commit 238b52358d
2 changed files with 15 additions and 2 deletions

View File

@ -30,7 +30,7 @@ use crate::{
};
pub use crate::{
completion::{CompletionItem, InsertText},
completion::{CompletionItem, CompletionItemKind, InsertText},
};
pub use ra_editor::{
FileSymbol, Fold, FoldKind, HighlightedRange, LineIndex, Runnable, RunnableKind, StructureNode,

View File

@ -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) -> <Self as Conv>::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() {