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.rs39
1 files changed, 7 insertions, 32 deletions
diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs
index 992955740..3f041f9c3 100644
--- a/crates/ra_ide_api/src/change.rs
+++ b/crates/ra_ide_api/src/change.rs
@@ -65,16 +65,8 @@ impl AnalysisChange {
65 path: RelativePathBuf, 65 path: RelativePathBuf,
66 text: Arc<String>, 66 text: Arc<String>,
67 ) { 67 ) {
68 let file = AddFile { 68 let file = AddFile { file_id, path, text };
69 file_id, 69 self.roots_changed.entry(root_id).or_default().added.push(file);
70 path,
71 text,
72 };
73 self.roots_changed
74 .entry(root_id)
75 .or_default()
76 .added
77 .push(file);
78 } 70 }
79 71
80 pub fn change_file(&mut self, file_id: FileId, new_text: Arc<String>) { 72 pub fn change_file(&mut self, file_id: FileId, new_text: Arc<String>) {
@@ -83,11 +75,7 @@ impl AnalysisChange {
83 75
84 pub fn remove_file(&mut self, root_id: SourceRootId, file_id: FileId, path: RelativePathBuf) { 76 pub fn remove_file(&mut self, root_id: SourceRootId, file_id: FileId, path: RelativePathBuf) {
85 let file = RemoveFile { file_id, path }; 77 let file = RemoveFile { file_id, path };
86 self.roots_changed 78 self.roots_changed.entry(root_id).or_default().removed.push(file);
87 .entry(root_id)
88 .or_default()
89 .removed
90 .push(file);
91 } 79 }
92 80
93 pub fn add_library(&mut self, data: LibraryData) { 81 pub fn add_library(&mut self, data: LibraryData) {
@@ -155,17 +143,9 @@ impl LibraryData {
155 let mut root_change = RootChange::default(); 143 let mut root_change = RootChange::default();
156 root_change.added = files 144 root_change.added = files
157 .into_iter() 145 .into_iter()
158 .map(|(file_id, path, text)| AddFile { 146 .map(|(file_id, path, text)| AddFile { file_id, path, text })
159 file_id,
160 path,
161 text,
162 })
163 .collect(); 147 .collect();
164 LibraryData { 148 LibraryData { root_id, root_change, symbol_index }
165 root_id,
166 root_change,
167 symbol_index,
168 }
169 } 149 }
170} 150}
171 151
@@ -226,10 +206,7 @@ impl RootDatabase {
226 self.last_gc_check = time::Instant::now(); 206 self.last_gc_check = time::Instant::now();
227 let retained_trees = syntax_tree_stats(self).retained; 207 let retained_trees = syntax_tree_stats(self).retained;
228 if retained_trees > 100 { 208 if retained_trees > 100 {
229 log::info!( 209 log::info!("automatic garbadge collection, {} retained trees", retained_trees);
230 "automatic garbadge collection, {} retained trees",
231 retained_trees
232 );
233 self.collect_garbage(); 210 self.collect_garbage();
234 } 211 }
235 } 212 }
@@ -238,9 +215,7 @@ impl RootDatabase {
238 pub(crate) fn collect_garbage(&mut self) { 215 pub(crate) fn collect_garbage(&mut self) {
239 self.last_gc = time::Instant::now(); 216 self.last_gc = time::Instant::now();
240 217
241 let sweep = SweepStrategy::default() 218 let sweep = SweepStrategy::default().discard_values().sweep_all_revisions();
242 .discard_values()
243 .sweep_all_revisions();
244 219
245 self.query(ra_db::ParseQuery).sweep(sweep); 220 self.query(ra_db::ParseQuery).sweep(sweep);
246 221