aboutsummaryrefslogtreecommitdiff
path: root/crates/base_db
diff options
context:
space:
mode:
Diffstat (limited to 'crates/base_db')
-rw-r--r--crates/base_db/src/change.rs2
-rw-r--r--crates/base_db/src/fixture.rs11
-rw-r--r--crates/base_db/src/input.rs2
3 files changed, 12 insertions, 3 deletions
diff --git a/crates/base_db/src/change.rs b/crates/base_db/src/change.rs
index 043e03bba..04e294e41 100644
--- a/crates/base_db/src/change.rs
+++ b/crates/base_db/src/change.rs
@@ -19,7 +19,7 @@ pub struct Change {
19 19
20impl fmt::Debug for Change { 20impl fmt::Debug for Change {
21 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { 21 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
22 let mut d = fmt.debug_struct("AnalysisChange"); 22 let mut d = fmt.debug_struct("Change");
23 if let Some(roots) = &self.roots { 23 if let Some(roots) = &self.roots {
24 d.field("roots", roots); 24 d.field("roots", roots);
25 } 25 }
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::{
67use vfs::{file_set::FileSet, VfsPath}; 67use vfs::{file_set::FileSet, VfsPath};
68 68
69use crate::{ 69use 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();
diff --git a/crates/base_db/src/input.rs b/crates/base_db/src/input.rs
index 2dd8fbe67..b5f7e4200 100644
--- a/crates/base_db/src/input.rs
+++ b/crates/base_db/src/input.rs
@@ -178,7 +178,7 @@ pub struct CrateData {
178 pub root_file_id: FileId, 178 pub root_file_id: FileId,
179 pub edition: Edition, 179 pub edition: Edition,
180 /// A name used in the package's project declaration: for Cargo projects, 180 /// A name used in the package's project declaration: for Cargo projects,
181 /// it's [package].name, can be different for other project types or even 181 /// its `[package].name` can be different for other project types or even
182 /// absent (a dummy crate for the code snippet, for example). 182 /// absent (a dummy crate for the code snippet, for example).
183 /// 183 ///
184 /// For purposes of analysis, crates are anonymous (only names in 184 /// For purposes of analysis, crates are anonymous (only names in