diff options
Diffstat (limited to 'crates/ra_analysis/src/extend_selection.rs')
-rw-r--r-- | crates/ra_analysis/src/extend_selection.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_analysis/src/extend_selection.rs b/crates/ra_analysis/src/extend_selection.rs index f1b77f981..3b130f966 100644 --- a/crates/ra_analysis/src/extend_selection.rs +++ b/crates/ra_analysis/src/extend_selection.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use ra_db::SyntaxDatabase; | 1 | use ra_db::SyntaxDatabase; |
2 | use ra_syntax::{ | 2 | use ra_syntax::{ |
3 | SyntaxNodeRef, AstNode, SourceFileNode, | 3 | SyntaxNode, AstNode, SourceFile, |
4 | ast, algo::find_covering_node, | 4 | ast, algo::find_covering_node, |
5 | }; | 5 | }; |
6 | 6 | ||
@@ -19,18 +19,18 @@ pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRang | |||
19 | 19 | ||
20 | fn extend_selection_in_macro( | 20 | fn extend_selection_in_macro( |
21 | _db: &RootDatabase, | 21 | _db: &RootDatabase, |
22 | source_file: &SourceFileNode, | 22 | source_file: &SourceFile, |
23 | frange: FileRange, | 23 | frange: FileRange, |
24 | ) -> Option<TextRange> { | 24 | ) -> Option<TextRange> { |
25 | let macro_call = find_macro_call(source_file.syntax(), frange.range)?; | 25 | let macro_call = find_macro_call(source_file.syntax(), frange.range)?; |
26 | let (off, exp) = hir::MacroDef::ast_expand(macro_call)?; | 26 | let (off, exp) = hir::MacroDef::ast_expand(macro_call)?; |
27 | let dst_range = exp.map_range_forward(frange.range - off)?; | 27 | let dst_range = exp.map_range_forward(frange.range - off)?; |
28 | let dst_range = ra_editor::extend_selection(exp.syntax().borrowed(), dst_range)?; | 28 | let dst_range = ra_editor::extend_selection(&exp.syntax(), dst_range)?; |
29 | let src_range = exp.map_range_back(dst_range)? + off; | 29 | let src_range = exp.map_range_back(dst_range)? + off; |
30 | Some(src_range) | 30 | Some(src_range) |
31 | } | 31 | } |
32 | 32 | ||
33 | fn find_macro_call(node: SyntaxNodeRef, range: TextRange) -> Option<ast::MacroCall> { | 33 | fn find_macro_call(node: &SyntaxNode, range: TextRange) -> Option<&ast::MacroCall> { |
34 | find_covering_node(node, range) | 34 | find_covering_node(node, range) |
35 | .ancestors() | 35 | .ancestors() |
36 | .find_map(ast::MacroCall::cast) | 36 | .find_map(ast::MacroCall::cast) |