aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/expand_macro.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ide/src/expand_macro.rs b/crates/ide/src/expand_macro.rs
index eebae5ebe..e0d01fa96 100644
--- a/crates/ide/src/expand_macro.rs
+++ b/crates/ide/src/expand_macro.rs
@@ -28,8 +28,8 @@ pub struct ExpandedMacro {
28pub(crate) fn expand_macro(db: &RootDatabase, position: FilePosition) -> Option<ExpandedMacro> { 28pub(crate) fn expand_macro(db: &RootDatabase, position: FilePosition) -> Option<ExpandedMacro> {
29 let sema = Semantics::new(db); 29 let sema = Semantics::new(db);
30 let file = sema.parse(position.file_id); 30 let file = sema.parse(position.file_id);
31 let name_ref = find_node_at_offset::<ast::NameRef>(file.syntax(), position.offset)?; 31 let mac = find_node_at_offset::<ast::MacroCall>(file.syntax(), position.offset)?;
32 let mac = name_ref.syntax().ancestors().find_map(ast::MacroCall::cast)?; 32 let name = mac.path()?.segment()?.name_ref()?;
33 33
34 let expanded = expand_macro_recur(&sema, &mac)?; 34 let expanded = expand_macro_recur(&sema, &mac)?;
35 35
@@ -37,7 +37,7 @@ pub(crate) fn expand_macro(db: &RootDatabase, position: FilePosition) -> Option<
37 // macro expansion may lose all white space information 37 // macro expansion may lose all white space information
38 // But we hope someday we can use ra_fmt for that 38 // But we hope someday we can use ra_fmt for that
39 let expansion = insert_whitespaces(expanded); 39 let expansion = insert_whitespaces(expanded);
40 Some(ExpandedMacro { name: name_ref.text().to_string(), expansion }) 40 Some(ExpandedMacro { name: name.to_string(), expansion })
41} 41}
42 42
43fn expand_macro_recur( 43fn expand_macro_recur(