From 3aaf20bd6ec75a572b13d020520d4df563a2891c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 11 Jan 2019 14:14:09 +0300 Subject: return ref ranges from gotodef --- crates/ra_lsp_server/src/main_loop/handlers.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'crates/ra_lsp_server/src/main_loop/handlers.rs') diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 5f4b27149..e3bf55ae7 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -9,7 +9,7 @@ use languageserver_types::{ SignatureInformation, SymbolInformation, TextDocumentIdentifier, TextEdit, WorkspaceEdit, }; use ra_ide_api::{ - FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, Severity, + FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, Severity, SourceChange, RangeInfo, }; use ra_syntax::{TextUnit, AstNode}; use rustc_hash::FxHashMap; @@ -208,12 +208,15 @@ pub fn handle_goto_definition( params: req::TextDocumentPositionParams, ) -> Result> { let position = params.try_conv_with(&world)?; - let navs = match world.analysis().goto_definition(position)? { + let nav_info = match world.analysis().goto_definition(position)? { None => return Ok(None), Some(it) => it, }; - let res = navs + let nav_range = nav_info.range; + let res = nav_info + .info .into_iter() + .map(|nav| RangeInfo::new(nav_range, nav)) .map(|nav| nav.try_conv_with(&world)) .collect::>>()?; Ok(Some(req::GotoDefinitionResponse::Array(res))) -- cgit v1.2.3