diff options
Diffstat (limited to 'crates/ra_analysis/src/imp.rs')
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index b24b5cfdc..69f5ed330 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -18,8 +18,9 @@ use crate::{ | |||
18 | AnalysisChange, | 18 | AnalysisChange, |
19 | db::{ | 19 | db::{ |
20 | self, SyntaxDatabase, | 20 | self, SyntaxDatabase, |
21 | input::{SourceRootId, FilesDatabase, SourceRoot, WORKSPACE} | 21 | |
22 | }, | 22 | }, |
23 | input::{SourceRootId, FilesDatabase, SourceRoot, WORKSPACE}, | ||
23 | descriptors::module::{ModulesDatabase, ModuleTree, Problem}, | 24 | descriptors::module::{ModulesDatabase, ModuleTree, Problem}, |
24 | descriptors::{FnDescriptor}, | 25 | descriptors::{FnDescriptor}, |
25 | CrateGraph, CrateId, Diagnostic, FileId, FileResolver, FileSystemEdit, Position, | 26 | CrateGraph, CrateId, Diagnostic, FileId, FileResolver, FileSystemEdit, Position, |
@@ -102,7 +103,7 @@ impl AnalysisHostImpl { | |||
102 | 103 | ||
103 | for (file_id, text) in change.files_changed { | 104 | for (file_id, text) in change.files_changed { |
104 | self.db | 105 | self.db |
105 | .query(db::input::FileTextQuery) | 106 | .query(crate::input::FileTextQuery) |
106 | .set(file_id, Arc::new(text)) | 107 | .set(file_id, Arc::new(text)) |
107 | } | 108 | } |
108 | if !(change.files_added.is_empty() && change.files_removed.is_empty()) { | 109 | if !(change.files_added.is_empty() && change.files_removed.is_empty()) { |
@@ -111,22 +112,22 @@ impl AnalysisHostImpl { | |||
111 | let mut source_root = SourceRoot::clone(&self.db.source_root(WORKSPACE)); | 112 | let mut source_root = SourceRoot::clone(&self.db.source_root(WORKSPACE)); |
112 | for (file_id, text) in change.files_added { | 113 | for (file_id, text) in change.files_added { |
113 | self.db | 114 | self.db |
114 | .query(db::input::FileTextQuery) | 115 | .query(crate::input::FileTextQuery) |
115 | .set(file_id, Arc::new(text)); | 116 | .set(file_id, Arc::new(text)); |
116 | self.db | 117 | self.db |
117 | .query(db::input::FileSourceRootQuery) | 118 | .query(crate::input::FileSourceRootQuery) |
118 | .set(file_id, db::input::WORKSPACE); | 119 | .set(file_id, crate::input::WORKSPACE); |
119 | source_root.files.insert(file_id); | 120 | source_root.files.insert(file_id); |
120 | } | 121 | } |
121 | for file_id in change.files_removed { | 122 | for file_id in change.files_removed { |
122 | self.db | 123 | self.db |
123 | .query(db::input::FileTextQuery) | 124 | .query(crate::input::FileTextQuery) |
124 | .set(file_id, Arc::new(String::new())); | 125 | .set(file_id, Arc::new(String::new())); |
125 | source_root.files.remove(&file_id); | 126 | source_root.files.remove(&file_id); |
126 | } | 127 | } |
127 | source_root.file_resolver = file_resolver; | 128 | source_root.file_resolver = file_resolver; |
128 | self.db | 129 | self.db |
129 | .query(db::input::SourceRootQuery) | 130 | .query(crate::input::SourceRootQuery) |
130 | .set(WORKSPACE, Arc::new(source_root)) | 131 | .set(WORKSPACE, Arc::new(source_root)) |
131 | } | 132 | } |
132 | if !change.libraries_added.is_empty() { | 133 | if !change.libraries_added.is_empty() { |
@@ -138,10 +139,10 @@ impl AnalysisHostImpl { | |||
138 | for (file_id, text) in library.files { | 139 | for (file_id, text) in library.files { |
139 | files.insert(file_id); | 140 | files.insert(file_id); |
140 | self.db | 141 | self.db |
141 | .query(db::input::FileSourceRootQuery) | 142 | .query(crate::input::FileSourceRootQuery) |
142 | .set_constant(file_id, source_root_id); | 143 | .set_constant(file_id, source_root_id); |
143 | self.db | 144 | self.db |
144 | .query(db::input::FileTextQuery) | 145 | .query(crate::input::FileTextQuery) |
145 | .set_constant(file_id, Arc::new(text)); | 146 | .set_constant(file_id, Arc::new(text)); |
146 | } | 147 | } |
147 | let source_root = SourceRoot { | 148 | let source_root = SourceRoot { |
@@ -149,18 +150,18 @@ impl AnalysisHostImpl { | |||
149 | file_resolver: library.file_resolver, | 150 | file_resolver: library.file_resolver, |
150 | }; | 151 | }; |
151 | self.db | 152 | self.db |
152 | .query(db::input::SourceRootQuery) | 153 | .query(crate::input::SourceRootQuery) |
153 | .set(source_root_id, Arc::new(source_root)); | 154 | .set(source_root_id, Arc::new(source_root)); |
154 | self.db | 155 | self.db |
155 | .query(db::input::LibrarySymbolsQuery) | 156 | .query(crate::input::LibrarySymbolsQuery) |
156 | .set(source_root_id, Arc::new(library.symbol_index)); | 157 | .set(source_root_id, Arc::new(library.symbol_index)); |
157 | } | 158 | } |
158 | self.db | 159 | self.db |
159 | .query(db::input::LibrarieseQuery) | 160 | .query(crate::input::LibrarieseQuery) |
160 | .set((), Arc::new(libraries)); | 161 | .set((), Arc::new(libraries)); |
161 | } | 162 | } |
162 | if let Some(crate_graph) = change.crate_graph { | 163 | if let Some(crate_graph) = change.crate_graph { |
163 | self.db.query(db::input::CrateGraphQuery) | 164 | self.db.query(crate::input::CrateGraphQuery) |
164 | .set((), Arc::new(crate_graph)) | 165 | .set((), Arc::new(crate_graph)) |
165 | } | 166 | } |
166 | } | 167 | } |