aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-09-07 20:03:39 +0100
committerAleksey Kladov <[email protected]>2018-09-07 20:05:05 +0100
commitfcfda94664b454f60be2dbc1b564ed63aa4c3ec5 (patch)
tree68f9a6821dbdcac491319dd31bcdeb1f0124a529 /crates
parentba7b3c2108c13c20d3e279ff5f0bb4cc9522e08a (diff)
Separete API from IMPL
Looks like there's a rule of thumb: don't call API functions from an implementation! In this case, following this rule of thumb saves us an Arc-bump!
Diffstat (limited to 'crates')
-rw-r--r--crates/libanalysis/src/lib.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/crates/libanalysis/src/lib.rs b/crates/libanalysis/src/lib.rs
index 4e63813f9..ff4fc709b 100644
--- a/crates/libanalysis/src/lib.rs
+++ b/crates/libanalysis/src/lib.rs
@@ -167,20 +167,20 @@ impl Analysis {
167 libeditor::matching_brace(file, offset) 167 libeditor::matching_brace(file, offset)
168 } 168 }
169 pub fn syntax_tree(&self, file_id: FileId) -> String { 169 pub fn syntax_tree(&self, file_id: FileId) -> String {
170 let file = self.file_syntax(file_id); 170 let file = self.imp.file_syntax(file_id);
171 libeditor::syntax_tree(&file) 171 libeditor::syntax_tree(file)
172 } 172 }
173 pub fn join_lines(&self, file_id: FileId, range: TextRange) -> SourceChange { 173 pub fn join_lines(&self, file_id: FileId, range: TextRange) -> SourceChange {
174 let file = self.file_syntax(file_id); 174 let file = self.imp.file_syntax(file_id);
175 SourceChange::from_local_edit(file_id, "join lines", libeditor::join_lines(&file, range)) 175 SourceChange::from_local_edit(file_id, "join lines", libeditor::join_lines(file, range))
176 } 176 }
177 pub fn on_eq_typed(&self, file_id: FileId, offset: TextUnit) -> Option<SourceChange> { 177 pub fn on_eq_typed(&self, file_id: FileId, offset: TextUnit) -> Option<SourceChange> {
178 let file = self.file_syntax(file_id); 178 let file = self.imp.file_syntax(file_id);
179 Some(SourceChange::from_local_edit(file_id, "add semicolon", libeditor::on_eq_typed(&file, offset)?)) 179 Some(SourceChange::from_local_edit(file_id, "add semicolon", libeditor::on_eq_typed(file, offset)?))
180 } 180 }
181 pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> { 181 pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> {
182 let file = self.file_syntax(file_id); 182 let file = self.imp.file_syntax(file_id);
183 libeditor::file_structure(&file) 183 libeditor::file_structure(file)
184 } 184 }
185 pub fn symbol_search(&self, query: Query, token: &JobToken) -> Vec<(FileId, FileSymbol)> { 185 pub fn symbol_search(&self, query: Query, token: &JobToken) -> Vec<(FileId, FileSymbol)> {
186 self.imp.world_symbols(query, token) 186 self.imp.world_symbols(query, token)
@@ -198,16 +198,16 @@ impl Analysis {
198 self.imp.crate_root(crate_id) 198 self.imp.crate_root(crate_id)
199 } 199 }
200 pub fn runnables(&self, file_id: FileId) -> Vec<Runnable> { 200 pub fn runnables(&self, file_id: FileId) -> Vec<Runnable> {
201 let file = self.file_syntax(file_id); 201 let file = self.imp.file_syntax(file_id);
202 libeditor::runnables(&file) 202 libeditor::runnables(file)
203 } 203 }
204 pub fn highlight(&self, file_id: FileId) -> Vec<HighlightedRange> { 204 pub fn highlight(&self, file_id: FileId) -> Vec<HighlightedRange> {
205 let file = self.file_syntax(file_id); 205 let file = self.imp.file_syntax(file_id);
206 libeditor::highlight(&file) 206 libeditor::highlight(file)
207 } 207 }
208 pub fn completions(&self, file_id: FileId, offset: TextUnit) -> Option<Vec<CompletionItem>> { 208 pub fn completions(&self, file_id: FileId, offset: TextUnit) -> Option<Vec<CompletionItem>> {
209 let file = self.file_syntax(file_id); 209 let file = self.imp.file_syntax(file_id);
210 libeditor::scope_completion(&file, offset) 210 libeditor::scope_completion(file, offset)
211 } 211 }
212 pub fn assists(&self, file_id: FileId, range: TextRange) -> Vec<SourceChange> { 212 pub fn assists(&self, file_id: FileId, range: TextRange) -> Vec<SourceChange> {
213 self.imp.assists(file_id, range) 213 self.imp.assists(file_id, range)