From 09c7c86696eb8289c9a8ab30bdbb824824c51eb1 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sun, 21 Jul 2019 23:28:05 +0300 Subject: Resolve types on the server --- crates/ra_lsp_server/src/main_loop/handlers.rs | 35 ++++++++------------------ 1 file changed, 10 insertions(+), 25 deletions(-) (limited to 'crates/ra_lsp_server') diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 1077aafd8..e5d2ff832 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -9,8 +9,7 @@ use lsp_types::{ TextDocumentIdentifier, TextEdit, WorkspaceEdit, }; use ra_ide_api::{ - AssistId, Cancelable, FileId, FilePosition, FileRange, FoldKind, InlayKind, Query, - RunnableKind, Severity, + AssistId, Cancelable, FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, Severity, }; use ra_prof::profile; use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit}; @@ -750,29 +749,15 @@ pub fn handle_code_lens( }), ); - lenses.extend( - analysis - .inlay_hints(file_id) - .into_iter() - .filter(|hint| hint.inlay_kind == InlayKind::LetBinding) - .filter_map(|inlay_hint| { - let resolved_type = analysis - .type_of(FileRange { range: inlay_hint.range, file_id }) - .ok() - .and_then(std::convert::identity) - .filter(|resolved_type| "{unknown}" != resolved_type); - resolved_type.map(|resolved_type| (resolved_type, inlay_hint.range)) - }) - .map(|(resolved_type, range)| CodeLens { - range: range.conv_with(&line_index), - command: Some(Command { - title: resolved_type, - command: String::new(), - arguments: None, - }), - data: None, - }), - ); + lenses.extend(analysis.inlay_hints(file_id)?.into_iter().map(|inlay_hint| CodeLens { + range: inlay_hint.range.conv_with(&line_index), + command: Some(Command { + title: inlay_hint.inlay_type_string, + command: String::new(), + arguments: None, + }), + data: None, + })); Ok(Some(lenses)) } -- cgit v1.2.3