aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-10-20 20:09:12 +0100
committerAleksey Kladov <[email protected]>2018-10-20 20:09:12 +0100
commit9fb41716de095fa365eecedab3427af7b5001644 (patch)
tree05b2d6bc6e02e493f39509a9c46d36564aef270b /crates/ra_analysis
parent998f2ae7627053a9363a05a1ab79359882dce39f (diff)
make more things cancelable
Diffstat (limited to 'crates/ra_analysis')
-rw-r--r--crates/ra_analysis/src/imp.rs2
-rw-r--r--crates/ra_analysis/src/lib.rs27
2 files changed, 14 insertions, 15 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs
index 4cfb681d8..d60fb8278 100644
--- a/crates/ra_analysis/src/imp.rs
+++ b/crates/ra_analysis/src/imp.rs
@@ -19,7 +19,7 @@ use rustc_hash::FxHashSet;
19use crate::{ 19use crate::{
20 descriptors::{FnDescriptor, ModuleTreeDescriptor, Problem}, 20 descriptors::{FnDescriptor, ModuleTreeDescriptor, Problem},
21 roots::{ReadonlySourceRoot, SourceRoot, WritableSourceRoot}, 21 roots::{ReadonlySourceRoot, SourceRoot, WritableSourceRoot},
22 CrateGraph, CrateId, Diagnostic, FileId, FileResolver, FileSystemEdit, JobToken, Position, 22 CrateGraph, CrateId, Diagnostic, FileId, FileResolver, FileSystemEdit, Position,
23 Query, SourceChange, SourceFileEdit, Cancelable, 23 Query, SourceChange, SourceFileEdit, Cancelable,
24}; 24};
25 25
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs
index 7e9798c29..8595d7e03 100644
--- a/crates/ra_analysis/src/lib.rs
+++ b/crates/ra_analysis/src/lib.rs
@@ -219,19 +219,23 @@ impl Analysis {
219 let file = self.imp.file_syntax(file_id); 219 let file = self.imp.file_syntax(file_id);
220 ra_editor::file_structure(&file) 220 ra_editor::file_structure(&file)
221 } 221 }
222 pub fn symbol_search(&self, query: Query) -> Vec<(FileId, FileSymbol)> { 222 pub fn folding_ranges(&self, file_id: FileId) -> Vec<Fold> {
223 self.imp.world_symbols(query) 223 let file = self.imp.file_syntax(file_id);
224 ra_editor::folding_ranges(&file)
225 }
226 pub fn symbol_search(&self, query: Query) -> Cancelable<Vec<(FileId, FileSymbol)>> {
227 Ok(self.imp.world_symbols(query))
224 } 228 }
225 pub fn approximately_resolve_symbol( 229 pub fn approximately_resolve_symbol(
226 &self, 230 &self,
227 file_id: FileId, 231 file_id: FileId,
228 offset: TextUnit 232 offset: TextUnit
229 ) -> Vec<(FileId, FileSymbol)> { 233 ) -> Cancelable<Vec<(FileId, FileSymbol)>> {
230 self.imp 234 Ok(self.imp
231 .approximately_resolve_symbol(file_id, offset) 235 .approximately_resolve_symbol(file_id, offset))
232 } 236 }
233 pub fn find_all_refs(&self, file_id: FileId, offset: TextUnit, ) -> Vec<(FileId, TextRange)> { 237 pub fn find_all_refs(&self, file_id: FileId, offset: TextUnit, ) -> Cancelable<Vec<(FileId, TextRange)>> {
234 self.imp.find_all_refs(file_id, offset) 238 Ok(self.imp.find_all_refs(file_id, offset))
235 } 239 }
236 pub fn parent_module(&self, file_id: FileId) -> Cancelable<Vec<(FileId, FileSymbol)>> { 240 pub fn parent_module(&self, file_id: FileId) -> Cancelable<Vec<(FileId, FileSymbol)>> {
237 self.imp.parent_module(file_id) 241 self.imp.parent_module(file_id)
@@ -260,17 +264,12 @@ impl Analysis {
260 pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> { 264 pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> {
261 Ok(self.imp.diagnostics(file_id)) 265 Ok(self.imp.diagnostics(file_id))
262 } 266 }
263 pub fn folding_ranges(&self, file_id: FileId) -> Vec<Fold> {
264 let file = self.imp.file_syntax(file_id);
265 ra_editor::folding_ranges(&file)
266 }
267
268 pub fn resolve_callable( 267 pub fn resolve_callable(
269 &self, 268 &self,
270 file_id: FileId, 269 file_id: FileId,
271 offset: TextUnit, 270 offset: TextUnit,
272 ) -> Option<(FnDescriptor, Option<usize>)> { 271 ) -> Cancelable<Option<(FnDescriptor, Option<usize>)>> {
273 self.imp.resolve_callable(file_id, offset) 272 Ok(self.imp.resolve_callable(file_id, offset))
274 } 273 }
275} 274}
276 275