aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/lib.rs')
-rw-r--r--crates/ra_ide/src/lib.rs38
1 files changed, 17 insertions, 21 deletions
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs
index 1527b27d4..013b960c1 100644
--- a/crates/ra_ide/src/lib.rs
+++ b/crates/ra_ide/src/lib.rs
@@ -10,11 +10,6 @@
10// For proving that RootDatabase is RefUnwindSafe. 10// For proving that RootDatabase is RefUnwindSafe.
11#![recursion_limit = "128"] 11#![recursion_limit = "128"]
12 12
13mod ide_db {
14 pub use ra_ide_db::*;
15}
16
17mod db;
18pub mod mock_analysis; 13pub mod mock_analysis;
19mod source_change; 14mod source_change;
20 15
@@ -56,13 +51,13 @@ use ra_db::{
56 salsa::{self, ParallelDatabase}, 51 salsa::{self, ParallelDatabase},
57 CheckCanceled, Env, FileLoader, SourceDatabase, 52 CheckCanceled, Env, FileLoader, SourceDatabase,
58}; 53};
54use ra_ide_db::{
55 symbol_index::{self, FileSymbol},
56 LineIndexDatabase,
57};
59use ra_syntax::{SourceFile, TextRange, TextUnit}; 58use ra_syntax::{SourceFile, TextRange, TextUnit};
60 59
61use crate::{ 60use crate::display::ToNav;
62 db::LineIndexDatabase,
63 display::ToNav,
64 ide_db::symbol_index::{self, FileSymbol},
65};
66 61
67pub use crate::{ 62pub use crate::{
68 assists::{Assist, AssistId}, 63 assists::{Assist, AssistId},
@@ -73,13 +68,6 @@ pub use crate::{
73 expand_macro::ExpandedMacro, 68 expand_macro::ExpandedMacro,
74 folding_ranges::{Fold, FoldKind}, 69 folding_ranges::{Fold, FoldKind},
75 hover::HoverResult, 70 hover::HoverResult,
76 ide_db::{
77 change::{AnalysisChange, LibraryData},
78 feature_flags::FeatureFlags,
79 line_index::{LineCol, LineIndex},
80 line_index_utils::translate_offset_with_edit,
81 symbol_index::Query,
82 },
83 inlay_hints::{InlayHint, InlayKind}, 71 inlay_hints::{InlayHint, InlayKind},
84 references::{ 72 references::{
85 Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult, SearchScope, 73 Declaration, Reference, ReferenceAccess, ReferenceKind, ReferenceSearchResult, SearchScope,
@@ -93,6 +81,14 @@ pub use hir::Documentation;
93pub use ra_db::{ 81pub use ra_db::{
94 Canceled, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRootId, 82 Canceled, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRootId,
95}; 83};
84pub use ra_ide_db::{
85 change::{AnalysisChange, LibraryData},
86 feature_flags::FeatureFlags,
87 line_index::{LineCol, LineIndex},
88 line_index_utils::translate_offset_with_edit,
89 symbol_index::Query,
90 RootDatabase,
91};
96 92
97pub type Cancelable<T> = Result<T, Canceled>; 93pub type Cancelable<T> = Result<T, Canceled>;
98 94
@@ -128,7 +124,7 @@ pub struct CallInfo {
128/// `AnalysisHost` stores the current state of the world. 124/// `AnalysisHost` stores the current state of the world.
129#[derive(Debug)] 125#[derive(Debug)]
130pub struct AnalysisHost { 126pub struct AnalysisHost {
131 db: db::RootDatabase, 127 db: RootDatabase,
132} 128}
133 129
134impl Default for AnalysisHost { 130impl Default for AnalysisHost {
@@ -139,7 +135,7 @@ impl Default for AnalysisHost {
139 135
140impl AnalysisHost { 136impl AnalysisHost {
141 pub fn new(lru_capcity: Option<usize>, feature_flags: FeatureFlags) -> AnalysisHost { 137 pub fn new(lru_capcity: Option<usize>, feature_flags: FeatureFlags) -> AnalysisHost {
142 AnalysisHost { db: db::RootDatabase::new(lru_capcity, feature_flags) } 138 AnalysisHost { db: RootDatabase::new(lru_capcity, feature_flags) }
143 } 139 }
144 /// Returns a snapshot of the current state, which you can query for 140 /// Returns a snapshot of the current state, which you can query for
145 /// semantic information. 141 /// semantic information.
@@ -189,7 +185,7 @@ impl AnalysisHost {
189/// `Analysis` are canceled (most method return `Err(Canceled)`). 185/// `Analysis` are canceled (most method return `Err(Canceled)`).
190#[derive(Debug)] 186#[derive(Debug)]
191pub struct Analysis { 187pub struct Analysis {
192 db: salsa::Snapshot<db::RootDatabase>, 188 db: salsa::Snapshot<RootDatabase>,
193} 189}
194 190
195// As a general design guideline, `Analysis` API are intended to be independent 191// As a general design guideline, `Analysis` API are intended to be independent
@@ -470,7 +466,7 @@ impl Analysis {
470 } 466 }
471 467
472 /// Performs an operation on that may be Canceled. 468 /// Performs an operation on that may be Canceled.
473 fn with_db<F: FnOnce(&db::RootDatabase) -> T + std::panic::UnwindSafe, T>( 469 fn with_db<F: FnOnce(&RootDatabase) -> T + std::panic::UnwindSafe, T>(
474 &self, 470 &self,
475 f: F, 471 f: F,
476 ) -> Cancelable<T> { 472 ) -> Cancelable<T> {