From 6bbcfca7aec6408cf27415ae6f965adc472d6f18 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 5 Nov 2018 14:10:20 +0300 Subject: Fully add inline modules to module tree --- crates/ra_lsp_server/src/main_loop/handlers.rs | 8 +++++--- crates/ra_lsp_server/src/req.rs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'crates/ra_lsp_server') diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index c853ff653..2219a0036 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -218,11 +218,13 @@ pub fn handle_goto_definition( pub fn handle_parent_module( world: ServerWorld, - params: TextDocumentIdentifier, + params: req::TextDocumentPositionParams, ) -> Result> { - let file_id = params.try_conv_with(&world)?; + let file_id = params.text_document.try_conv_with(&world)?; + let line_index = world.analysis().file_line_index(file_id); + let offset = params.position.conv_with(&line_index); let mut res = Vec::new(); - for (file_id, symbol) in world.analysis().parent_module(file_id)? { + for (file_id, symbol) in world.analysis().parent_module(file_id, offset)? { let line_index = world.analysis().file_line_index(file_id); let location = to_location(file_id, symbol.node_range, &world, &line_index)?; res.push(location); diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs index 9d911912d..fcb7e94e1 100644 --- a/crates/ra_lsp_server/src/req.rs +++ b/crates/ra_lsp_server/src/req.rs @@ -93,7 +93,7 @@ pub struct Decoration { pub enum ParentModule {} impl Request for ParentModule { - type Params = TextDocumentIdentifier; + type Params = TextDocumentPositionParams; type Result = Vec; const METHOD: &'static str = "m/parentModule"; } -- cgit v1.2.3