aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/extend_selection.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/extend_selection.rs')
-rw-r--r--crates/ra_ide_api/src/extend_selection.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_ide_api/src/extend_selection.rs b/crates/ra_ide_api/src/extend_selection.rs
index 655852514..491b15702 100644
--- a/crates/ra_ide_api/src/extend_selection.rs
+++ b/crates/ra_ide_api/src/extend_selection.rs
@@ -11,8 +11,8 @@ use crate::{db::RootDatabase, FileRange};
11 11
12// FIXME: restore macro support 12// FIXME: restore macro support
13pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRange { 13pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRange {
14 let source_file = db.parse(frange.file_id).tree; 14 let parse = db.parse(frange.file_id);
15 try_extend_selection(source_file.syntax(), frange.range).unwrap_or(frange.range) 15 try_extend_selection(parse.tree().syntax(), frange.range).unwrap_or(frange.range)
16} 16}
17 17
18fn try_extend_selection(root: &SyntaxNode, range: TextRange) -> Option<TextRange> { 18fn try_extend_selection(root: &SyntaxNode, range: TextRange) -> Option<TextRange> {
@@ -212,10 +212,10 @@ mod tests {
212 212
213 fn do_check(before: &str, afters: &[&str]) { 213 fn do_check(before: &str, afters: &[&str]) {
214 let (cursor, before) = extract_offset(before); 214 let (cursor, before) = extract_offset(before);
215 let file = SourceFile::parse(&before).tree; 215 let parse = SourceFile::parse(&before);
216 let mut range = TextRange::offset_len(cursor, 0.into()); 216 let mut range = TextRange::offset_len(cursor, 0.into());
217 for &after in afters { 217 for &after in afters {
218 range = try_extend_selection(file.syntax(), range).unwrap(); 218 range = try_extend_selection(parse.tree().syntax(), range).unwrap();
219 let actual = &before[range]; 219 let actual = &before[range];
220 assert_eq!(after, actual); 220 assert_eq!(after, actual);
221 } 221 }