diff options
Diffstat (limited to 'crates/base_db')
-rw-r--r-- | crates/base_db/src/fixture.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/base_db/src/fixture.rs b/crates/base_db/src/fixture.rs index 98acd61b1..5c9824814 100644 --- a/crates/base_db/src/fixture.rs +++ b/crates/base_db/src/fixture.rs | |||
@@ -67,7 +67,7 @@ use test_utils::{ | |||
67 | use vfs::{file_set::FileSet, VfsPath}; | 67 | use vfs::{file_set::FileSet, VfsPath}; |
68 | 68 | ||
69 | use crate::{ | 69 | use crate::{ |
70 | input::CrateName, Change, CrateGraph, CrateId, Edition, Env, FileId, FilePosition, | 70 | input::CrateName, Change, CrateGraph, CrateId, Edition, Env, FileId, FilePosition, FileRange, |
71 | SourceDatabaseExt, SourceRoot, SourceRootId, | 71 | SourceDatabaseExt, SourceRoot, SourceRootId, |
72 | }; | 72 | }; |
73 | 73 | ||
@@ -99,6 +99,15 @@ pub trait WithFixture: Default + SourceDatabaseExt + 'static { | |||
99 | (db, FilePosition { file_id, offset }) | 99 | (db, FilePosition { file_id, offset }) |
100 | } | 100 | } |
101 | 101 | ||
102 | fn with_range(ra_fixture: &str) -> (Self, FileRange) { | ||
103 | let (db, file_id, range_or_offset) = Self::with_range_or_offset(ra_fixture); | ||
104 | let range = match range_or_offset { | ||
105 | RangeOrOffset::Range(it) => it, | ||
106 | RangeOrOffset::Offset(_) => panic!(), | ||
107 | }; | ||
108 | (db, FileRange { file_id, range }) | ||
109 | } | ||
110 | |||
102 | fn with_range_or_offset(ra_fixture: &str) -> (Self, FileId, RangeOrOffset) { | 111 | fn with_range_or_offset(ra_fixture: &str) -> (Self, FileId, RangeOrOffset) { |
103 | let fixture = ChangeFixture::parse(ra_fixture); | 112 | let fixture = ChangeFixture::parse(ra_fixture); |
104 | let mut db = Self::default(); | 113 | let mut db = Self::default(); |