aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main_loop
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-30 19:19:31 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-30 19:19:31 +0000
commitb704ce803b99f0c69bbcd3d4ab531d2604de8594 (patch)
tree4b347869363f7d7fef0f16ab5f56c7be9c94952a /crates/ra_lsp_server/src/main_loop
parent897e74f089ee4c13aeca6f0244c7809c1b631a34 (diff)
parent04eb15856bd183db3a1785b7cb74e0c32fd78a39 (diff)
Merge #702
702: Go to Implementation r=matklad a=kjeremy First half of #620 Co-authored-by: Jeremy Kolb <[email protected]> Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop')
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index 4f75f9a22..74554f15c 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -229,6 +229,26 @@ pub fn handle_goto_definition(
229 Ok(Some(req::GotoDefinitionResponse::Link(res))) 229 Ok(Some(req::GotoDefinitionResponse::Link(res)))
230} 230}
231 231
232pub fn handle_goto_implementation(
233 world: ServerWorld,
234 params: req::TextDocumentPositionParams,
235) -> Result<Option<req::GotoImplementationResponse>> {
236 let position = params.try_conv_with(&world)?;
237 let line_index = world.analysis().file_line_index(position.file_id);
238 let nav_info = match world.analysis().goto_implementation(position)? {
239 None => return Ok(None),
240 Some(it) => it,
241 };
242 let nav_range = nav_info.range;
243 let res = nav_info
244 .info
245 .into_iter()
246 .map(|nav| RangeInfo::new(nav_range, nav))
247 .map(|nav| to_location_link(&nav, &world, &line_index))
248 .collect::<Result<Vec<_>>>()?;
249 Ok(Some(req::GotoDefinitionResponse::Link(res)))
250}
251
232pub fn handle_parent_module( 252pub fn handle_parent_module(
233 world: ServerWorld, 253 world: ServerWorld,
234 params: req::TextDocumentPositionParams, 254 params: req::TextDocumentPositionParams,