aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-12-20 09:06:23 +0000
committerAleksey Kladov <[email protected]>2018-12-20 09:15:38 +0000
commita084412f0698d5f54d586f707930e141c88b0673 (patch)
treeff90eb390a8f5af47b6d0c6ec4c49b4431b82d1c /crates
parent6782fe2a5b84315f66a227b035c6beae7834f0b0 (diff)
set symbol index as const
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_analysis/src/imp.rs30
1 files changed, 1 insertions, 29 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs
index 4ef2129c3..c4291885a 100644
--- a/crates/ra_analysis/src/imp.rs
+++ b/crates/ra_analysis/src/imp.rs
@@ -74,7 +74,7 @@ impl AnalysisHostImpl {
74 self.db 74 self.db
75 .query_mut(LibrarySymbolsQuery) 75 .query_mut(LibrarySymbolsQuery)
76 .set_constant(library.root_id, Arc::new(library.symbol_index)); 76 .set_constant(library.root_id, Arc::new(library.symbol_index));
77 self.apply_root_change_constant(library.root_id, library.root_change); 77 self.apply_root_change(library.root_id, library.root_change);
78 } 78 }
79 self.db 79 self.db
80 .query_mut(ra_db::LibraryRootsQuery) 80 .query_mut(ra_db::LibraryRootsQuery)
@@ -115,34 +115,6 @@ impl AnalysisHostImpl {
115 .set(root_id, Arc::new(source_root)); 115 .set(root_id, Arc::new(source_root));
116 } 116 }
117 117
118 fn apply_root_change_constant(&mut self, root_id: SourceRootId, root_change: RootChange) {
119 let mut source_root = SourceRoot::clone(&self.db.source_root(root_id));
120 for add_file in root_change.added {
121 self.db
122 .query_mut(ra_db::FileTextQuery)
123 .set_constant(add_file.file_id, add_file.text);
124 self.db
125 .query_mut(ra_db::FileRelativePathQuery)
126 .set_constant(add_file.file_id, add_file.path.clone());
127 self.db
128 .query_mut(ra_db::FileSourceRootQuery)
129 .set_constant(add_file.file_id, root_id);
130 source_root.files.insert(add_file.path, add_file.file_id);
131 }
132 for remove_file in root_change.removed {
133 self.db
134 .query_mut(ra_db::FileTextQuery)
135 .set_constant(remove_file.file_id, Default::default());
136 self.db
137 .query_mut(ra_db::FileRelativePathQuery)
138 .set_constant(remove_file.file_id, Default::default());
139 source_root.files.remove(&remove_file.path);
140 }
141 self.db
142 .query_mut(ra_db::SourceRootQuery)
143 .set_constant(root_id, Arc::new(source_root));
144 }
145
146 #[allow(unused)] 118 #[allow(unused)]
147 /// Ideally, we should call this function from time to time to collect heavy 119 /// Ideally, we should call this function from time to time to collect heavy
148 /// syntax trees. However, if we actually do that, everything is recomputed 120 /// syntax trees. However, if we actually do that, everything is recomputed