aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-12-21 12:19:46 +0000
committerAleksey Kladov <[email protected]>2018-12-21 12:19:46 +0000
commit4092b8d0b58598d0b4b820fff37b1d8c741c47b9 (patch)
tree44312d5b3dfb66706aeaab8703e3ceaabb4ecf5a /crates/ra_lsp_server
parentb5c5995bf13da31bb97113a7eea5c138555c2b1b (diff)
make compleion item details private
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index 1751d7fa8..2dfeb061a 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -8,7 +8,7 @@ use languageserver_types::{
8 PrepareRenameResponse, RenameParams, SymbolInformation, TextDocumentIdentifier, TextEdit, 8 PrepareRenameResponse, RenameParams, SymbolInformation, TextDocumentIdentifier, TextEdit,
9 WorkspaceEdit, ParameterInformation, ParameterLabel, SignatureInformation, Hover, HoverContents, 9 WorkspaceEdit, ParameterInformation, ParameterLabel, SignatureInformation, Hover, HoverContents,
10}; 10};
11use ra_analysis::{FileId, FoldKind, Query, RunnableKind, FilePosition}; 11use ra_analysis::{FileId, FoldKind, Query, RunnableKind, FilePosition, InsertText};
12use ra_syntax::{TextUnit, text_utils::intersect}; 12use ra_syntax::{TextUnit, text_utils::intersect};
13use ra_text_edit::text_utils::contains_offset_nonstrict; 13use ra_text_edit::text_utils::contains_offset_nonstrict;
14use rustc_hash::FxHashMap; 14use rustc_hash::FxHashMap;
@@ -423,15 +423,21 @@ pub fn handle_completion(
423 .into_iter() 423 .into_iter()
424 .map(|item| { 424 .map(|item| {
425 let mut res = CompletionItem { 425 let mut res = CompletionItem {
426 label: item.label, 426 label: item.label().to_string(),
427 filter_text: item.lookup, 427 filter_text: Some(item.lookup().to_string()),
428 ..Default::default() 428 ..Default::default()
429 }; 429 };
430 if let Some(snip) = item.snippet { 430 match item.insert_text() {
431 res.insert_text = Some(snip); 431 InsertText::PlainText { text } => {
432 res.insert_text_format = Some(InsertTextFormat::Snippet); 432 res.insert_text = Some(text);
433 res.kind = Some(CompletionItemKind::Keyword); 433 res.insert_text_format = Some(InsertTextFormat::PlainText);
434 }; 434 }
435 InsertText::Snippet { text } => {
436 res.insert_text = Some(text);
437 res.insert_text_format = Some(InsertTextFormat::Snippet);
438 res.kind = Some(CompletionItemKind::Keyword);
439 }
440 }
435 res 441 res
436 }) 442 })
437 .collect(); 443 .collect();