aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/change.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/change.rs')
-rw-r--r--crates/ra_ide_api/src/change.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs
index 89631935a..0d52f5ffb 100644
--- a/crates/ra_ide_api/src/change.rs
+++ b/crates/ra_ide_api/src/change.rs
@@ -2,7 +2,7 @@ use std::{fmt, sync::Arc, time};
2 2
3use ra_db::{ 3use ra_db::{
4 salsa::{Database, Durability, SweepStrategy}, 4 salsa::{Database, Durability, SweepStrategy},
5 CrateGraph, FileId, SourceDatabase, SourceRoot, SourceRootId, 5 CrateGraph, CrateId, FileId, SourceDatabase, SourceRoot, SourceRootId,
6}; 6};
7use ra_prof::{memory_usage, profile, Bytes}; 7use ra_prof::{memory_usage, profile, Bytes};
8use ra_syntax::SourceFile; 8use ra_syntax::SourceFile;
@@ -11,7 +11,7 @@ use relative_path::RelativePathBuf;
11use rustc_hash::FxHashMap; 11use rustc_hash::FxHashMap;
12 12
13use crate::{ 13use crate::{
14 db::RootDatabase, 14 db::{DebugData, RootDatabase},
15 status::syntax_tree_stats, 15 status::syntax_tree_stats,
16 symbol_index::{SymbolIndex, SymbolsDatabase}, 16 symbol_index::{SymbolIndex, SymbolsDatabase},
17}; 17};
@@ -23,6 +23,7 @@ pub struct AnalysisChange {
23 files_changed: Vec<(FileId, Arc<String>)>, 23 files_changed: Vec<(FileId, Arc<String>)>,
24 libraries_added: Vec<LibraryData>, 24 libraries_added: Vec<LibraryData>,
25 crate_graph: Option<CrateGraph>, 25 crate_graph: Option<CrateGraph>,
26 debug_data: DebugData,
26} 27}
27 28
28impl fmt::Debug for AnalysisChange { 29impl fmt::Debug for AnalysisChange {
@@ -83,6 +84,14 @@ impl AnalysisChange {
83 pub fn set_crate_graph(&mut self, graph: CrateGraph) { 84 pub fn set_crate_graph(&mut self, graph: CrateGraph) {
84 self.crate_graph = Some(graph); 85 self.crate_graph = Some(graph);
85 } 86 }
87
88 pub fn set_debug_crate_name(&mut self, crate_id: CrateId, name: String) {
89 self.debug_data.crate_names.insert(crate_id, name);
90 }
91
92 pub fn set_debug_root_path(&mut self, source_root_id: SourceRootId, path: String) {
93 self.debug_data.root_paths.insert(source_root_id, path);
94 }
86} 95}
87 96
88#[derive(Debug)] 97#[derive(Debug)]
@@ -200,6 +209,8 @@ impl RootDatabase {
200 if let Some(crate_graph) = change.crate_graph { 209 if let Some(crate_graph) = change.crate_graph {
201 self.set_crate_graph_with_durability(Arc::new(crate_graph), Durability::HIGH) 210 self.set_crate_graph_with_durability(Arc::new(crate_graph), Durability::HIGH)
202 } 211 }
212
213 Arc::make_mut(&mut self.debug_data).merge(change.debug_data)
203 } 214 }
204 215
205 fn apply_root_change(&mut self, root_id: SourceRootId, root_change: RootChange) { 216 fn apply_root_change(&mut self, root_id: SourceRootId, root_change: RootChange) {