aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main_loop
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-11 11:14:09 +0000
committerAleksey Kladov <[email protected]>2019-01-11 13:06:08 +0000
commit3aaf20bd6ec75a572b13d020520d4df563a2891c (patch)
treeaa2a0b8e64896423b9324a44ef1f36141ff757bb /crates/ra_lsp_server/src/main_loop
parentf9ed8d4d23cd210f24ca303c72b436bfbe84741f (diff)
return ref ranges from gotodef
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop')
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs9
1 files changed, 6 insertions, 3 deletions
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::{
9 SignatureInformation, SymbolInformation, TextDocumentIdentifier, TextEdit, WorkspaceEdit, 9 SignatureInformation, SymbolInformation, TextDocumentIdentifier, TextEdit, WorkspaceEdit,
10}; 10};
11use ra_ide_api::{ 11use ra_ide_api::{
12 FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, Severity, 12 FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, Severity, SourceChange, RangeInfo,
13}; 13};
14use ra_syntax::{TextUnit, AstNode}; 14use ra_syntax::{TextUnit, AstNode};
15use rustc_hash::FxHashMap; 15use rustc_hash::FxHashMap;
@@ -208,12 +208,15 @@ pub fn handle_goto_definition(
208 params: req::TextDocumentPositionParams, 208 params: req::TextDocumentPositionParams,
209) -> Result<Option<req::GotoDefinitionResponse>> { 209) -> Result<Option<req::GotoDefinitionResponse>> {
210 let position = params.try_conv_with(&world)?; 210 let position = params.try_conv_with(&world)?;
211 let navs = match world.analysis().goto_definition(position)? { 211 let nav_info = match world.analysis().goto_definition(position)? {
212 None => return Ok(None), 212 None => return Ok(None),
213 Some(it) => it, 213 Some(it) => it,
214 }; 214 };
215 let res = navs 215 let nav_range = nav_info.range;
216 let res = nav_info
217 .info
216 .into_iter() 218 .into_iter()
219 .map(|nav| RangeInfo::new(nav_range, nav))
217 .map(|nav| nav.try_conv_with(&world)) 220 .map(|nav| nav.try_conv_with(&world))
218 .collect::<Result<Vec<_>>>()?; 221 .collect::<Result<Vec<_>>>()?;
219 Ok(Some(req::GotoDefinitionResponse::Array(res))) 222 Ok(Some(req::GotoDefinitionResponse::Array(res)))