mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Fully add inline modules to module tree
This commit is contained in:
parent
44d8919384
commit
6bbcfca7ae
9 changed files with 99 additions and 47 deletions
|
@ -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);
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue