File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -28,16 +28,16 @@ pub struct ExpandedMacro {
28
28
pub ( crate ) fn expand_macro ( db : & RootDatabase , position : FilePosition ) -> Option < ExpandedMacro > {
29
29
let sema = Semantics :: new ( db) ;
30
30
let file = sema. parse ( position. file_id ) ;
31
- let name_ref = find_node_at_offset :: < ast:: NameRef > ( file. syntax ( ) , position. offset ) ?;
32
- let mac = name_ref . syntax ( ) . ancestors ( ) . find_map ( ast :: MacroCall :: cast ) ?;
31
+ let mac = find_node_at_offset :: < ast:: MacroCall > ( file. syntax ( ) , position. offset ) ?;
32
+ let name = mac . path ( ) ? . segment ( ) ? . name_ref ( ) ?;
33
33
34
34
let expanded = expand_macro_recur ( & sema, & mac) ?;
35
35
36
36
// FIXME:
37
37
// macro expansion may lose all white space information
38
38
// But we hope someday we can use ra_fmt for that
39
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
43
43
fn expand_macro_recur (
You can’t perform that action at this time.
0 commit comments