Fully add inline modules to module tree

This commit is contained in:
Aleksey Kladov 2018-11-05 14:10:20 +03:00
parent 44d8919384
commit 6bbcfca7ae
9 changed files with 99 additions and 47 deletions

View file

@ -218,11 +218,13 @@ pub fn handle_goto_definition(
pub fn handle_parent_module(
world: ServerWorld,
params: TextDocumentIdentifier,
params: req::TextDocumentPositionParams,
) -> Result<Vec<Location>> {
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);

View file

@ -93,7 +93,7 @@ pub struct Decoration {
pub enum ParentModule {}
impl Request for ParentModule {
type Params = TextDocumentIdentifier;
type Params = TextDocumentPositionParams;
type Result = Vec<Location>;
const METHOD: &'static str = "m/parentModule";
}