aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main_loop
diff options
context:
space:
mode:
authorkjeremy <[email protected]>2019-04-23 19:11:27 +0100
committerkjeremy <[email protected]>2019-04-23 19:32:47 +0100
commit7125192c1e46f2350707c4903a1679b2a0178ea6 (patch)
tree4bcb7609a4477a270f361c7e83abdb093107d040 /crates/ra_lsp_server/src/main_loop
parenta094d5c621e44ff78dce953c0cae7cfba4b2840e (diff)
Basic resolution for ADT
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 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,