From 9fb41716de095fa365eecedab3427af7b5001644 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 20 Oct 2018 22:09:12 +0300 Subject: make more things cancelable --- crates/ra_analysis/src/imp.rs | 2 +- crates/ra_analysis/src/lib.rs | 27 +++++++++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) (limited to 'crates/ra_analysis') 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; use crate::{ descriptors::{FnDescriptor, ModuleTreeDescriptor, Problem}, roots::{ReadonlySourceRoot, SourceRoot, WritableSourceRoot}, - CrateGraph, CrateId, Diagnostic, FileId, FileResolver, FileSystemEdit, JobToken, Position, + CrateGraph, CrateId, Diagnostic, FileId, FileResolver, FileSystemEdit, Position, Query, SourceChange, SourceFileEdit, Cancelable, }; 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 { let file = self.imp.file_syntax(file_id); ra_editor::file_structure(&file) } - pub fn symbol_search(&self, query: Query) -> Vec<(FileId, FileSymbol)> { - self.imp.world_symbols(query) + pub fn folding_ranges(&self, file_id: FileId) -> Vec { + let file = self.imp.file_syntax(file_id); + ra_editor::folding_ranges(&file) + } + pub fn symbol_search(&self, query: Query) -> Cancelable> { + Ok(self.imp.world_symbols(query)) } pub fn approximately_resolve_symbol( &self, file_id: FileId, offset: TextUnit - ) -> Vec<(FileId, FileSymbol)> { - self.imp - .approximately_resolve_symbol(file_id, offset) + ) -> Cancelable> { + Ok(self.imp + .approximately_resolve_symbol(file_id, offset)) } - pub fn find_all_refs(&self, file_id: FileId, offset: TextUnit, ) -> Vec<(FileId, TextRange)> { - self.imp.find_all_refs(file_id, offset) + pub fn find_all_refs(&self, file_id: FileId, offset: TextUnit, ) -> Cancelable> { + Ok(self.imp.find_all_refs(file_id, offset)) } pub fn parent_module(&self, file_id: FileId) -> Cancelable> { self.imp.parent_module(file_id) @@ -260,17 +264,12 @@ impl Analysis { pub fn diagnostics(&self, file_id: FileId) -> Cancelable> { Ok(self.imp.diagnostics(file_id)) } - pub fn folding_ranges(&self, file_id: FileId) -> Vec { - let file = self.imp.file_syntax(file_id); - ra_editor::folding_ranges(&file) - } - pub fn resolve_callable( &self, file_id: FileId, offset: TextUnit, - ) -> Option<(FnDescriptor, Option)> { - self.imp.resolve_callable(file_id, offset) + ) -> Cancelable)>> { + Ok(self.imp.resolve_callable(file_id, offset)) } } -- cgit v1.2.3