mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Add recursive expand in vscode
This commit is contained in:
parent
d2782ab1c1
commit
3ccd05fedc
8 changed files with 210 additions and 5 deletions
|
@ -47,6 +47,21 @@ pub fn handle_syntax_tree(world: WorldSnapshot, params: req::SyntaxTreeParams) -
|
|||
Ok(res)
|
||||
}
|
||||
|
||||
pub fn handle_expand_macro(
|
||||
world: WorldSnapshot,
|
||||
params: req::ExpandMacroParams,
|
||||
) -> Result<Option<(String, String)>> {
|
||||
let _p = profile("handle_expand_macro");
|
||||
let file_id = params.text_document.try_conv_with(&world)?;
|
||||
let line_index = world.analysis().file_line_index(file_id)?;
|
||||
let offset = params.position.map(|p| p.conv_with(&line_index));
|
||||
|
||||
match offset {
|
||||
None => Ok(None),
|
||||
Some(offset) => Ok(world.analysis().expand_macro(FilePosition { file_id, offset })?),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_selection_range(
|
||||
world: WorldSnapshot,
|
||||
params: req::SelectionRangeParams,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue