mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Change return type of expand_macro
This commit is contained in:
parent
94c63d2802
commit
4012da07fd
5 changed files with 33 additions and 13 deletions
|
@ -50,7 +50,7 @@ pub fn handle_syntax_tree(world: WorldSnapshot, params: req::SyntaxTreeParams) -
|
|||
pub fn handle_expand_macro(
|
||||
world: WorldSnapshot,
|
||||
params: req::ExpandMacroParams,
|
||||
) -> Result<Option<(String, String)>> {
|
||||
) -> Result<Option<req::ExpandedMacro>> {
|
||||
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)?;
|
||||
|
@ -58,7 +58,10 @@ pub fn handle_expand_macro(
|
|||
|
||||
match offset {
|
||||
None => Ok(None),
|
||||
Some(offset) => Ok(world.analysis().expand_macro(FilePosition { file_id, offset })?),
|
||||
Some(offset) => {
|
||||
let res = world.analysis().expand_macro(FilePosition { file_id, offset })?;
|
||||
Ok(res.map(|it| req::ExpandedMacro { name: it.name, expansion: it.expansion }))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue