aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/lib.rs')
-rw-r--r--crates/ra_analysis/src/lib.rs44
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;
9extern crate rustc_hash; 9extern crate rustc_hash;
10extern crate salsa; 10extern crate salsa;
11 11
12mod arena; 12macro_rules! ctry {
13 ($expr:expr) => {
14 match $expr {
15 None => return Ok(None),
16 Some(it) => it,
17 }
18 };
19}
20
13mod db; 21mod db;
14mod loc2id;
15mod input;
16mod imp; 22mod imp;
17mod completion; 23mod completion;
18mod descriptors;
19mod symbol_index; 24mod symbol_index;
20mod syntax_ptr;
21pub mod mock_analysis; 25pub mod mock_analysis;
22 26
23use std::{fmt, sync::Arc}; 27use std::{fmt, sync::Arc};
24 28
25use ra_syntax::{AtomEdit, SourceFileNode, TextRange, TextUnit}; 29use ra_syntax::{AtomEdit, SourceFileNode, TextRange, TextUnit};
30use ra_db::FileResolverImp;
26use rayon::prelude::*; 31use rayon::prelude::*;
27use relative_path::RelativePathBuf; 32use relative_path::RelativePathBuf;
28 33
29use crate::{ 34use crate::{
30 imp::{AnalysisHostImpl, AnalysisImpl, FileResolverImp}, 35 imp::{AnalysisHostImpl, AnalysisImpl},
31 symbol_index::SymbolIndex, 36 symbol_index::SymbolIndex,
32}; 37};
33 38
34pub use crate::{ 39pub use crate::{
35 completion::CompletionItem, 40 completion::CompletionItem,
36 descriptors::function::FnDescriptor,
37 input::{CrateGraph, CrateId, FileId, FileResolver},
38}; 41};
39pub use ra_editor::{ 42pub use ra_editor::{
40 FileSymbol, Fold, FoldKind, HighlightedRange, LineIndex, Runnable, RunnableKind, StructureNode, 43 FileSymbol, Fold, FoldKind, HighlightedRange, LineIndex, Runnable, RunnableKind, StructureNode,
41}; 44};
45pub use hir::FnSignatureInfo;
42 46
43#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] 47pub use ra_db::{
44pub struct Canceled; 48 Canceled, Cancelable, FilePosition,
45 49 CrateGraph, CrateId, FileId, FileResolver
46pub type Cancelable<T> = Result<T, Canceled>; 50};
47
48impl 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
54impl std::error::Error for Canceled {}
55 51
56#[derive(Default)] 52#[derive(Default)]
57pub struct AnalysisChange { 53pub struct AnalysisChange {
@@ -121,12 +117,6 @@ impl AnalysisHost {
121 } 117 }
122} 118}
123 119
124#[derive(Clone, Copy, Debug)]
125pub struct FilePosition {
126 pub file_id: FileId,
127 pub offset: TextUnit,
128}
129
130#[derive(Debug)] 120#[derive(Debug)]
131pub struct SourceChange { 121pub 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}