diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide_db/src/change.rs | 9 | ||||
-rw-r--r-- | crates/ra_ide_db/src/lib.rs | 18 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cli/load_cargo.rs | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/src/global_state.rs | 1 |
4 files changed, 3 insertions, 29 deletions
diff --git a/crates/ra_ide_db/src/change.rs b/crates/ra_ide_db/src/change.rs index 5dbe1c1b7..2fc796a85 100644 --- a/crates/ra_ide_db/src/change.rs +++ b/crates/ra_ide_db/src/change.rs | |||
@@ -16,7 +16,7 @@ use rustc_hash::FxHashMap; | |||
16 | 16 | ||
17 | use crate::{ | 17 | use crate::{ |
18 | symbol_index::{SymbolIndex, SymbolsDatabase}, | 18 | symbol_index::{SymbolIndex, SymbolsDatabase}, |
19 | DebugData, RootDatabase, | 19 | RootDatabase, |
20 | }; | 20 | }; |
21 | 21 | ||
22 | #[derive(Default)] | 22 | #[derive(Default)] |
@@ -26,7 +26,6 @@ pub struct AnalysisChange { | |||
26 | files_changed: Vec<(FileId, Arc<String>)>, | 26 | files_changed: Vec<(FileId, Arc<String>)>, |
27 | libraries_added: Vec<LibraryData>, | 27 | libraries_added: Vec<LibraryData>, |
28 | crate_graph: Option<CrateGraph>, | 28 | crate_graph: Option<CrateGraph>, |
29 | debug_data: DebugData, | ||
30 | } | 29 | } |
31 | 30 | ||
32 | impl fmt::Debug for AnalysisChange { | 31 | impl fmt::Debug for AnalysisChange { |
@@ -87,10 +86,6 @@ impl AnalysisChange { | |||
87 | pub fn set_crate_graph(&mut self, graph: CrateGraph) { | 86 | pub fn set_crate_graph(&mut self, graph: CrateGraph) { |
88 | self.crate_graph = Some(graph); | 87 | self.crate_graph = Some(graph); |
89 | } | 88 | } |
90 | |||
91 | pub fn set_debug_root_path(&mut self, source_root_id: SourceRootId, path: String) { | ||
92 | self.debug_data.root_paths.insert(source_root_id, path); | ||
93 | } | ||
94 | } | 89 | } |
95 | 90 | ||
96 | #[derive(Debug)] | 91 | #[derive(Debug)] |
@@ -218,8 +213,6 @@ impl RootDatabase { | |||
218 | if let Some(crate_graph) = change.crate_graph { | 213 | if let Some(crate_graph) = change.crate_graph { |
219 | self.set_crate_graph_with_durability(Arc::new(crate_graph), Durability::HIGH) | 214 | self.set_crate_graph_with_durability(Arc::new(crate_graph), Durability::HIGH) |
220 | } | 215 | } |
221 | |||
222 | Arc::make_mut(&mut self.debug_data).merge(change.debug_data) | ||
223 | } | 216 | } |
224 | 217 | ||
225 | fn apply_root_change(&mut self, root_id: SourceRootId, root_change: RootChange) { | 218 | fn apply_root_change(&mut self, root_id: SourceRootId, root_change: RootChange) { |
diff --git a/crates/ra_ide_db/src/lib.rs b/crates/ra_ide_db/src/lib.rs index 480fd4576..a808de4f1 100644 --- a/crates/ra_ide_db/src/lib.rs +++ b/crates/ra_ide_db/src/lib.rs | |||
@@ -17,9 +17,9 @@ use hir::db::{AstDatabase, DefDatabase}; | |||
17 | use ra_db::{ | 17 | use ra_db::{ |
18 | salsa::{self, Database, Durability}, | 18 | salsa::{self, Database, Durability}, |
19 | Canceled, CheckCanceled, CrateId, FileId, FileLoader, FileLoaderDelegate, SourceDatabase, | 19 | Canceled, CheckCanceled, CrateId, FileId, FileLoader, FileLoaderDelegate, SourceDatabase, |
20 | SourceRootId, Upcast, | 20 | Upcast, |
21 | }; | 21 | }; |
22 | use rustc_hash::{FxHashMap, FxHashSet}; | 22 | use rustc_hash::FxHashSet; |
23 | 23 | ||
24 | use crate::{line_index::LineIndex, symbol_index::SymbolsDatabase}; | 24 | use crate::{line_index::LineIndex, symbol_index::SymbolsDatabase}; |
25 | 25 | ||
@@ -36,7 +36,6 @@ use crate::{line_index::LineIndex, symbol_index::SymbolsDatabase}; | |||
36 | #[derive(Debug)] | 36 | #[derive(Debug)] |
37 | pub struct RootDatabase { | 37 | pub struct RootDatabase { |
38 | runtime: salsa::Runtime<RootDatabase>, | 38 | runtime: salsa::Runtime<RootDatabase>, |
39 | pub(crate) debug_data: Arc<DebugData>, | ||
40 | pub last_gc: crate::wasm_shims::Instant, | 39 | pub last_gc: crate::wasm_shims::Instant, |
41 | pub last_gc_check: crate::wasm_shims::Instant, | 40 | pub last_gc_check: crate::wasm_shims::Instant, |
42 | } | 41 | } |
@@ -98,7 +97,6 @@ impl RootDatabase { | |||
98 | runtime: salsa::Runtime::default(), | 97 | runtime: salsa::Runtime::default(), |
99 | last_gc: crate::wasm_shims::Instant::now(), | 98 | last_gc: crate::wasm_shims::Instant::now(), |
100 | last_gc_check: crate::wasm_shims::Instant::now(), | 99 | last_gc_check: crate::wasm_shims::Instant::now(), |
101 | debug_data: Default::default(), | ||
102 | }; | 100 | }; |
103 | db.set_crate_graph_with_durability(Default::default(), Durability::HIGH); | 101 | db.set_crate_graph_with_durability(Default::default(), Durability::HIGH); |
104 | db.set_local_roots_with_durability(Default::default(), Durability::HIGH); | 102 | db.set_local_roots_with_durability(Default::default(), Durability::HIGH); |
@@ -121,7 +119,6 @@ impl salsa::ParallelDatabase for RootDatabase { | |||
121 | runtime: self.runtime.snapshot(self), | 119 | runtime: self.runtime.snapshot(self), |
122 | last_gc: self.last_gc, | 120 | last_gc: self.last_gc, |
123 | last_gc_check: self.last_gc_check, | 121 | last_gc_check: self.last_gc_check, |
124 | debug_data: Arc::clone(&self.debug_data), | ||
125 | }) | 122 | }) |
126 | } | 123 | } |
127 | } | 124 | } |
@@ -135,14 +132,3 @@ fn line_index(db: &impl LineIndexDatabase, file_id: FileId) -> Arc<LineIndex> { | |||
135 | let text = db.file_text(file_id); | 132 | let text = db.file_text(file_id); |
136 | Arc::new(LineIndex::new(&*text)) | 133 | Arc::new(LineIndex::new(&*text)) |
137 | } | 134 | } |
138 | |||
139 | #[derive(Debug, Default, Clone)] | ||
140 | pub(crate) struct DebugData { | ||
141 | pub(crate) root_paths: FxHashMap<SourceRootId, String>, | ||
142 | } | ||
143 | |||
144 | impl DebugData { | ||
145 | pub(crate) fn merge(&mut self, other: DebugData) { | ||
146 | self.root_paths.extend(other.root_paths.into_iter()); | ||
147 | } | ||
148 | } | ||
diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs index 45af96317..97367d7c6 100644 --- a/crates/rust-analyzer/src/cli/load_cargo.rs +++ b/crates/rust-analyzer/src/cli/load_cargo.rs | |||
@@ -111,10 +111,6 @@ pub(crate) fn load( | |||
111 | vfs.root2path(root) | 111 | vfs.root2path(root) |
112 | ); | 112 | ); |
113 | analysis_change.add_root(source_root_id, is_local); | 113 | analysis_change.add_root(source_root_id, is_local); |
114 | analysis_change.set_debug_root_path( | ||
115 | source_root_id, | ||
116 | source_roots[&source_root_id].path().display().to_string(), | ||
117 | ); | ||
118 | 114 | ||
119 | let vfs_root_path = vfs.root2path(root); | 115 | let vfs_root_path = vfs.root2path(root); |
120 | if extern_dirs.contains(&vfs_root_path) { | 116 | if extern_dirs.contains(&vfs_root_path) { |
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index 96d91b12d..21116e165 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs | |||
@@ -126,7 +126,6 @@ impl GlobalState { | |||
126 | let vfs_root_path = vfs.root2path(r); | 126 | let vfs_root_path = vfs.root2path(r); |
127 | let is_local = local_roots.iter().any(|it| vfs_root_path.starts_with(it)); | 127 | let is_local = local_roots.iter().any(|it| vfs_root_path.starts_with(it)); |
128 | change.add_root(SourceRootId(r.0), is_local); | 128 | change.add_root(SourceRootId(r.0), is_local); |
129 | change.set_debug_root_path(SourceRootId(r.0), vfs_root_path.display().to_string()); | ||
130 | 129 | ||
131 | // FIXME: add path2root in vfs to simpily this logic | 130 | // FIXME: add path2root in vfs to simpily this logic |
132 | if extern_dirs.contains(&vfs_root_path) { | 131 | if extern_dirs.contains(&vfs_root_path) { |