diff options
Diffstat (limited to 'crates/ra_ide/src/expand.rs')
-rw-r--r-- | crates/ra_ide/src/expand.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_ide/src/expand.rs b/crates/ra_ide/src/expand.rs index 7a22bb0a4..b82259a3d 100644 --- a/crates/ra_ide/src/expand.rs +++ b/crates/ra_ide/src/expand.rs | |||
@@ -76,14 +76,15 @@ pub(crate) fn descend_into_macros( | |||
76 | ) -> InFile<SyntaxToken> { | 76 | ) -> InFile<SyntaxToken> { |
77 | let src = InFile::new(file_id.into(), token); | 77 | let src = InFile::new(file_id.into(), token); |
78 | 78 | ||
79 | let source_analyzer = | ||
80 | hir::SourceAnalyzer::new(db, src.with_value(src.value.parent()).as_ref(), None); | ||
81 | |||
79 | successors(Some(src), |token| { | 82 | successors(Some(src), |token| { |
80 | let macro_call = token.value.ancestors().find_map(ast::MacroCall::cast)?; | 83 | let macro_call = token.value.ancestors().find_map(ast::MacroCall::cast)?; |
81 | let tt = macro_call.token_tree()?; | 84 | let tt = macro_call.token_tree()?; |
82 | if !token.value.text_range().is_subrange(&tt.syntax().text_range()) { | 85 | if !token.value.text_range().is_subrange(&tt.syntax().text_range()) { |
83 | return None; | 86 | return None; |
84 | } | 87 | } |
85 | let source_analyzer = | ||
86 | hir::SourceAnalyzer::new(db, token.with_value(token.value.parent()).as_ref(), None); | ||
87 | let exp = source_analyzer.expand(db, token.with_value(¯o_call))?; | 88 | let exp = source_analyzer.expand(db, token.with_value(¯o_call))?; |
88 | exp.map_token_down(db, token.as_ref()) | 89 | exp.map_token_down(db, token.as_ref()) |
89 | }) | 90 | }) |