diff options
author | Aleksey Kladov <[email protected]> | 2018-10-20 19:52:49 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-10-20 19:52:49 +0100 |
commit | c4b0d3cd56ab68f4fa23f7c1f6c76f7f6148153e (patch) | |
tree | 90b7472979686314ca041dfe5ee7f95277827f9d /crates/ra_analysis/src/imp.rs | |
parent | 61518580ed60bb16edcd4fb7200d0b564b5ee9e9 (diff) |
make parent module cancelable
Diffstat (limited to 'crates/ra_analysis/src/imp.rs')
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index a67b1717a..3a135ef13 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -20,7 +20,7 @@ use 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, JobToken, Position, |
23 | Query, SourceChange, SourceFileEdit, | 23 | Query, SourceChange, SourceFileEdit, Cancelable, |
24 | }; | 24 | }; |
25 | 25 | ||
26 | #[derive(Clone, Debug)] | 26 | #[derive(Clone, Debug)] |
@@ -157,10 +157,10 @@ impl AnalysisImpl { | |||
157 | } | 157 | } |
158 | query.search(&buf, token) | 158 | query.search(&buf, token) |
159 | } | 159 | } |
160 | pub fn parent_module(&self, file_id: FileId) -> Vec<(FileId, FileSymbol)> { | 160 | pub fn parent_module(&self, file_id: FileId) -> Cancelable<Vec<(FileId, FileSymbol)>> { |
161 | let root = self.root(file_id); | 161 | let root = self.root(file_id); |
162 | let module_tree = root.module_tree(); | 162 | let module_tree = root.module_tree(); |
163 | module_tree | 163 | let res = module_tree |
164 | .parent_modules(file_id) | 164 | .parent_modules(file_id) |
165 | .iter() | 165 | .iter() |
166 | .map(|link| { | 166 | .map(|link| { |
@@ -174,7 +174,8 @@ impl AnalysisImpl { | |||
174 | }; | 174 | }; |
175 | (file_id, sym) | 175 | (file_id, sym) |
176 | }) | 176 | }) |
177 | .collect() | 177 | .collect(); |
178 | Ok(res) | ||
178 | } | 179 | } |
179 | pub fn crate_for(&self, file_id: FileId) -> Vec<CrateId> { | 180 | pub fn crate_for(&self, file_id: FileId) -> Vec<CrateId> { |
180 | let module_tree = self.root(file_id).module_tree(); | 181 | let module_tree = self.root(file_id).module_tree(); |