aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/extend_selection.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-08 08:47:28 +0000
committerAleksey Kladov <[email protected]>2019-01-08 08:47:28 +0000
commit3ffd5dd2a63e8efe182e79439a879ec1f9420b77 (patch)
tree5a674d9b89081a371f07b5a0c0a21f0b71d7e75a /crates/ra_analysis/src/extend_selection.rs
parentda0b348ae9f629c5cbe4a836a90ed85e36ca18e5 (diff)
migrate ra_analysis to new rowan
Diffstat (limited to 'crates/ra_analysis/src/extend_selection.rs')
-rw-r--r--crates/ra_analysis/src/extend_selection.rs8
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 @@
1use ra_db::SyntaxDatabase; 1use ra_db::SyntaxDatabase;
2use ra_syntax::{ 2use 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
20fn extend_selection_in_macro( 20fn 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
33fn find_macro_call(node: SyntaxNodeRef, range: TextRange) -> Option<ast::MacroCall> { 33fn 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)