aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main_loop/handlers.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop/handlers.rs')
-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 530081494..23802e5e1 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -288,6 +288,26 @@ pub fn handle_goto_implementation(
288 Ok(Some(req::GotoDefinitionResponse::Link(res))) 288 Ok(Some(req::GotoDefinitionResponse::Link(res)))
289} 289}
290 290
291pub fn handle_goto_type_definition(
292 world: ServerWorld,
293 params: req::TextDocumentPositionParams,
294) -> Result<Option<req::GotoTypeDefinitionResponse>> {
295 let position = params.try_conv_with(&world)?;
296 let line_index = world.analysis().file_line_index(position.file_id);
297 let nav_info = match world.analysis().goto_type_definition(position)? {
298 None => return Ok(None),
299 Some(it) => it,
300 };
301 let nav_range = nav_info.range;
302 let res = nav_info
303 .info
304 .into_iter()
305 .map(|nav| RangeInfo::new(nav_range, nav))
306 .map(|nav| to_location_link(&nav, &world, &line_index))
307 .collect::<Result<Vec<_>>>()?;
308 Ok(Some(req::GotoDefinitionResponse::Link(res)))
309}
310
291pub fn handle_parent_module( 311pub fn handle_parent_module(
292 world: ServerWorld, 312 world: ServerWorld,
293 params: req::TextDocumentPositionParams, 313 params: req::TextDocumentPositionParams,