diff options
Diffstat (limited to 'crates/ra_analysis/src/lib.rs')
-rw-r--r-- | crates/ra_analysis/src/lib.rs | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index cedbd1fc8..12df580ba 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs | |||
@@ -9,49 +9,45 @@ extern crate relative_path; | |||
9 | extern crate rustc_hash; | 9 | extern crate rustc_hash; |
10 | extern crate salsa; | 10 | extern crate salsa; |
11 | 11 | ||
12 | mod arena; | 12 | macro_rules! ctry { |
13 | ($expr:expr) => { | ||
14 | match $expr { | ||
15 | None => return Ok(None), | ||
16 | Some(it) => it, | ||
17 | } | ||
18 | }; | ||
19 | } | ||
20 | |||
13 | mod db; | 21 | mod db; |
14 | mod loc2id; | ||
15 | mod input; | ||
16 | mod imp; | 22 | mod imp; |
17 | mod completion; | 23 | mod completion; |
18 | mod descriptors; | ||
19 | mod symbol_index; | 24 | mod symbol_index; |
20 | mod syntax_ptr; | ||
21 | pub mod mock_analysis; | 25 | pub mod mock_analysis; |
22 | 26 | ||
23 | use std::{fmt, sync::Arc}; | 27 | use std::{fmt, sync::Arc}; |
24 | 28 | ||
25 | use ra_syntax::{AtomEdit, SourceFileNode, TextRange, TextUnit}; | 29 | use ra_syntax::{AtomEdit, SourceFileNode, TextRange, TextUnit}; |
30 | use ra_db::FileResolverImp; | ||
26 | use rayon::prelude::*; | 31 | use rayon::prelude::*; |
27 | use relative_path::RelativePathBuf; | 32 | use relative_path::RelativePathBuf; |
28 | 33 | ||
29 | use crate::{ | 34 | use crate::{ |
30 | imp::{AnalysisHostImpl, AnalysisImpl, FileResolverImp}, | 35 | imp::{AnalysisHostImpl, AnalysisImpl}, |
31 | symbol_index::SymbolIndex, | 36 | symbol_index::SymbolIndex, |
32 | }; | 37 | }; |
33 | 38 | ||
34 | pub use crate::{ | 39 | pub use crate::{ |
35 | completion::CompletionItem, | 40 | completion::CompletionItem, |
36 | descriptors::function::FnDescriptor, | ||
37 | input::{CrateGraph, CrateId, FileId, FileResolver}, | ||
38 | }; | 41 | }; |
39 | pub use ra_editor::{ | 42 | pub use ra_editor::{ |
40 | FileSymbol, Fold, FoldKind, HighlightedRange, LineIndex, Runnable, RunnableKind, StructureNode, | 43 | FileSymbol, Fold, FoldKind, HighlightedRange, LineIndex, Runnable, RunnableKind, StructureNode, |
41 | }; | 44 | }; |
45 | pub use hir::FnSignatureInfo; | ||
42 | 46 | ||
43 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] | 47 | pub use ra_db::{ |
44 | pub struct Canceled; | 48 | Canceled, Cancelable, FilePosition, |
45 | 49 | CrateGraph, CrateId, FileId, FileResolver | |
46 | pub type Cancelable<T> = Result<T, Canceled>; | 50 | }; |
47 | |||
48 | impl std::fmt::Display for Canceled { | ||
49 | fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
50 | fmt.write_str("Canceled") | ||
51 | } | ||
52 | } | ||
53 | |||
54 | impl std::error::Error for Canceled {} | ||
55 | 51 | ||
56 | #[derive(Default)] | 52 | #[derive(Default)] |
57 | pub struct AnalysisChange { | 53 | pub struct AnalysisChange { |
@@ -121,12 +117,6 @@ impl AnalysisHost { | |||
121 | } | 117 | } |
122 | } | 118 | } |
123 | 119 | ||
124 | #[derive(Clone, Copy, Debug)] | ||
125 | pub struct FilePosition { | ||
126 | pub file_id: FileId, | ||
127 | pub offset: TextUnit, | ||
128 | } | ||
129 | |||
130 | #[derive(Debug)] | 120 | #[derive(Debug)] |
131 | pub struct SourceChange { | 121 | pub struct SourceChange { |
132 | pub label: String, | 122 | pub label: String, |
@@ -296,7 +286,7 @@ impl Analysis { | |||
296 | pub fn resolve_callable( | 286 | pub fn resolve_callable( |
297 | &self, | 287 | &self, |
298 | position: FilePosition, | 288 | position: FilePosition, |
299 | ) -> Cancelable<Option<(FnDescriptor, Option<usize>)>> { | 289 | ) -> Cancelable<Option<(FnSignatureInfo, Option<usize>)>> { |
300 | self.imp.resolve_callable(position) | 290 | self.imp.resolve_callable(position) |
301 | } | 291 | } |
302 | } | 292 | } |