Add recursive expand in vscode

This commit is contained in:
Edwin Cheng 2019-11-18 02:47:50 +08:00
parent d2782ab1c1
commit 3ccd05fedc
8 changed files with 210 additions and 5 deletions

View file

@ -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,