diff options
Diffstat (limited to 'crates')
31 files changed, 103 insertions, 100 deletions
diff --git a/crates/ra_ide/src/assists.rs b/crates/ra_ide/src/assists.rs index c43c45c65..f26047570 100644 --- a/crates/ra_ide/src/assists.rs +++ b/crates/ra_ide/src/assists.rs | |||
@@ -1,13 +1,13 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use either::Either; | ||
4 | use ra_assists::{AssistAction, AssistLabel}; | ||
3 | use ra_db::{FilePosition, FileRange}; | 5 | use ra_db::{FilePosition, FileRange}; |
6 | use ra_ide_db::RootDatabase; | ||
7 | |||
8 | use crate::{imports_locator::ImportsLocatorIde, FileId, SourceChange, SourceFileEdit}; | ||
4 | 9 | ||
5 | use crate::{ | ||
6 | db::RootDatabase, imports_locator::ImportsLocatorIde, FileId, SourceChange, SourceFileEdit, | ||
7 | }; | ||
8 | use either::Either; | ||
9 | pub use ra_assists::AssistId; | 10 | pub use ra_assists::AssistId; |
10 | use ra_assists::{AssistAction, AssistLabel}; | ||
11 | 11 | ||
12 | #[derive(Debug)] | 12 | #[derive(Debug)] |
13 | pub struct Assist { | 13 | pub struct Assist { |
diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs index aa5d60c7b..f984f40ad 100644 --- a/crates/ra_ide/src/call_hierarchy.rs +++ b/crates/ra_ide/src/call_hierarchy.rs | |||
@@ -3,6 +3,7 @@ | |||
3 | use indexmap::IndexMap; | 3 | use indexmap::IndexMap; |
4 | 4 | ||
5 | use hir::db::AstDatabase; | 5 | use hir::db::AstDatabase; |
6 | use ra_ide_db::RootDatabase; | ||
6 | use ra_syntax::{ | 7 | use ra_syntax::{ |
7 | ast::{self, DocCommentsOwner}, | 8 | ast::{self, DocCommentsOwner}, |
8 | match_ast, AstNode, TextRange, | 9 | match_ast, AstNode, TextRange, |
@@ -10,7 +11,6 @@ use ra_syntax::{ | |||
10 | 11 | ||
11 | use crate::{ | 12 | use crate::{ |
12 | call_info::FnCallNode, | 13 | call_info::FnCallNode, |
13 | db::RootDatabase, | ||
14 | display::{ShortLabel, ToNav}, | 14 | display::{ShortLabel, ToNav}, |
15 | expand::descend_into_macros, | 15 | expand::descend_into_macros, |
16 | goto_definition, references, FilePosition, NavigationTarget, RangeInfo, | 16 | goto_definition, references, FilePosition, NavigationTarget, RangeInfo, |
diff --git a/crates/ra_ide/src/call_info.rs b/crates/ra_ide/src/call_info.rs index 72a68522e..f2b29306e 100644 --- a/crates/ra_ide/src/call_info.rs +++ b/crates/ra_ide/src/call_info.rs | |||
@@ -1,15 +1,13 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | use hir::db::AstDatabase; | 2 | use hir::db::AstDatabase; |
3 | use ra_ide_db::RootDatabase; | ||
3 | use ra_syntax::{ | 4 | use ra_syntax::{ |
4 | ast::{self, ArgListOwner}, | 5 | ast::{self, ArgListOwner}, |
5 | match_ast, AstNode, SyntaxNode, | 6 | match_ast, AstNode, SyntaxNode, |
6 | }; | 7 | }; |
7 | |||
8 | use test_utils::tested_by; | 8 | use test_utils::tested_by; |
9 | 9 | ||
10 | use crate::{ | 10 | use crate::{expand::descend_into_macros, CallInfo, FilePosition, FunctionSignature}; |
11 | db::RootDatabase, expand::descend_into_macros, CallInfo, FilePosition, FunctionSignature, | ||
12 | }; | ||
13 | 11 | ||
14 | /// Computes parameter information for the given call expression. | 12 | /// Computes parameter information for the given call expression. |
15 | pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option<CallInfo> { | 13 | pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option<CallInfo> { |
diff --git a/crates/ra_ide/src/completion.rs b/crates/ra_ide/src/completion.rs index abe1f36ce..fedc02e14 100644 --- a/crates/ra_ide/src/completion.rs +++ b/crates/ra_ide/src/completion.rs | |||
@@ -17,6 +17,7 @@ mod complete_postfix; | |||
17 | mod complete_macro_in_item_position; | 17 | mod complete_macro_in_item_position; |
18 | 18 | ||
19 | use ra_db::SourceDatabase; | 19 | use ra_db::SourceDatabase; |
20 | use ra_ide_db::RootDatabase; | ||
20 | 21 | ||
21 | #[cfg(test)] | 22 | #[cfg(test)] |
22 | use crate::completion::completion_item::do_completion; | 23 | use crate::completion::completion_item::do_completion; |
@@ -25,7 +26,7 @@ use crate::{ | |||
25 | completion_context::CompletionContext, | 26 | completion_context::CompletionContext, |
26 | completion_item::{CompletionKind, Completions}, | 27 | completion_item::{CompletionKind, Completions}, |
27 | }, | 28 | }, |
28 | db, FilePosition, | 29 | FilePosition, |
29 | }; | 30 | }; |
30 | 31 | ||
31 | pub use crate::completion::completion_item::{ | 32 | pub use crate::completion::completion_item::{ |
@@ -54,7 +55,7 @@ pub use crate::completion::completion_item::{ | |||
54 | /// `foo` *should* be present among the completion variants. Filtering by | 55 | /// `foo` *should* be present among the completion variants. Filtering by |
55 | /// identifier prefix/fuzzy match should be done higher in the stack, together | 56 | /// identifier prefix/fuzzy match should be done higher in the stack, together |
56 | /// with ordering of completions (currently this is done by the client). | 57 | /// with ordering of completions (currently this is done by the client). |
57 | pub(crate) fn completions(db: &db::RootDatabase, position: FilePosition) -> Option<Completions> { | 58 | pub(crate) fn completions(db: &RootDatabase, position: FilePosition) -> Option<Completions> { |
58 | let original_parse = db.parse(position.file_id); | 59 | let original_parse = db.parse(position.file_id); |
59 | let ctx = CompletionContext::new(db, &original_parse, position)?; | 60 | let ctx = CompletionContext::new(db, &original_parse, position)?; |
60 | 61 | ||
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index deaacda6c..5a0407fd7 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs | |||
@@ -1,5 +1,6 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use ra_ide_db::RootDatabase; | ||
3 | use ra_syntax::{ | 4 | use ra_syntax::{ |
4 | algo::{find_covering_element, find_node_at_offset}, | 5 | algo::{find_covering_element, find_node_at_offset}, |
5 | ast, AstNode, Parse, SourceFile, | 6 | ast, AstNode, Parse, SourceFile, |
@@ -8,13 +9,13 @@ use ra_syntax::{ | |||
8 | }; | 9 | }; |
9 | use ra_text_edit::AtomTextEdit; | 10 | use ra_text_edit::AtomTextEdit; |
10 | 11 | ||
11 | use crate::{db, FilePosition}; | 12 | use crate::FilePosition; |
12 | 13 | ||
13 | /// `CompletionContext` is created early during completion to figure out, where | 14 | /// `CompletionContext` is created early during completion to figure out, where |
14 | /// exactly is the cursor, syntax-wise. | 15 | /// exactly is the cursor, syntax-wise. |
15 | #[derive(Debug)] | 16 | #[derive(Debug)] |
16 | pub(crate) struct CompletionContext<'a> { | 17 | pub(crate) struct CompletionContext<'a> { |
17 | pub(super) db: &'a db::RootDatabase, | 18 | pub(super) db: &'a RootDatabase, |
18 | pub(super) analyzer: hir::SourceAnalyzer, | 19 | pub(super) analyzer: hir::SourceAnalyzer, |
19 | pub(super) offset: TextUnit, | 20 | pub(super) offset: TextUnit, |
20 | pub(super) token: SyntaxToken, | 21 | pub(super) token: SyntaxToken, |
@@ -48,7 +49,7 @@ pub(crate) struct CompletionContext<'a> { | |||
48 | 49 | ||
49 | impl<'a> CompletionContext<'a> { | 50 | impl<'a> CompletionContext<'a> { |
50 | pub(super) fn new( | 51 | pub(super) fn new( |
51 | db: &'a db::RootDatabase, | 52 | db: &'a RootDatabase, |
52 | original_parse: &'a Parse<ast::SourceFile>, | 53 | original_parse: &'a Parse<ast::SourceFile>, |
53 | position: FilePosition, | 54 | position: FilePosition, |
54 | ) -> Option<CompletionContext<'a>> { | 55 | ) -> Option<CompletionContext<'a>> { |
diff --git a/crates/ra_ide/src/db.rs b/crates/ra_ide/src/db.rs deleted file mode 100644 index 2849cdb02..000000000 --- a/crates/ra_ide/src/db.rs +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | pub(crate) use crate::ide_db::*; | ||
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index f403b3bcf..22bd49723 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs | |||
@@ -5,6 +5,7 @@ use std::cell::RefCell; | |||
5 | use hir::diagnostics::{AstDiagnostic, Diagnostic as _, DiagnosticSink}; | 5 | use hir::diagnostics::{AstDiagnostic, Diagnostic as _, DiagnosticSink}; |
6 | use itertools::Itertools; | 6 | use itertools::Itertools; |
7 | use ra_db::{RelativePath, SourceDatabase, SourceDatabaseExt}; | 7 | use ra_db::{RelativePath, SourceDatabase, SourceDatabaseExt}; |
8 | use ra_ide_db::RootDatabase; | ||
8 | use ra_prof::profile; | 9 | use ra_prof::profile; |
9 | use ra_syntax::{ | 10 | use ra_syntax::{ |
10 | algo, | 11 | algo, |
@@ -13,7 +14,7 @@ use ra_syntax::{ | |||
13 | }; | 14 | }; |
14 | use ra_text_edit::{TextEdit, TextEditBuilder}; | 15 | use ra_text_edit::{TextEdit, TextEditBuilder}; |
15 | 16 | ||
16 | use crate::{db::RootDatabase, Diagnostic, FileId, FileSystemEdit, SourceChange, SourceFileEdit}; | 17 | use crate::{Diagnostic, FileId, FileSystemEdit, SourceChange, SourceFileEdit}; |
17 | 18 | ||
18 | #[derive(Debug, Copy, Clone)] | 19 | #[derive(Debug, Copy, Clone)] |
19 | pub enum Severity { | 20 | pub enum Severity { |
diff --git a/crates/ra_ide/src/display/function_signature.rs b/crates/ra_ide/src/display/function_signature.rs index 1e4a472b4..c23e08e9a 100644 --- a/crates/ra_ide/src/display/function_signature.rs +++ b/crates/ra_ide/src/display/function_signature.rs | |||
@@ -4,13 +4,11 @@ use std::fmt::{self, Display}; | |||
4 | 4 | ||
5 | use hir::{Docs, Documentation, HasSource, HirDisplay}; | 5 | use hir::{Docs, Documentation, HasSource, HirDisplay}; |
6 | use join_to_string::join; | 6 | use join_to_string::join; |
7 | use ra_ide_db::RootDatabase; | ||
7 | use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner}; | 8 | use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner}; |
8 | use std::convert::From; | 9 | use std::convert::From; |
9 | 10 | ||
10 | use crate::{ | 11 | use crate::display::{generic_parameters, where_predicates}; |
11 | db, | ||
12 | display::{generic_parameters, where_predicates}, | ||
13 | }; | ||
14 | 12 | ||
15 | #[derive(Debug)] | 13 | #[derive(Debug)] |
16 | pub enum CallableKind { | 14 | pub enum CallableKind { |
@@ -48,13 +46,13 @@ impl FunctionSignature { | |||
48 | self | 46 | self |
49 | } | 47 | } |
50 | 48 | ||
51 | pub(crate) fn from_hir(db: &db::RootDatabase, function: hir::Function) -> Self { | 49 | pub(crate) fn from_hir(db: &RootDatabase, function: hir::Function) -> Self { |
52 | let doc = function.docs(db); | 50 | let doc = function.docs(db); |
53 | let ast_node = function.source(db).value; | 51 | let ast_node = function.source(db).value; |
54 | FunctionSignature::from(&ast_node).with_doc_opt(doc) | 52 | FunctionSignature::from(&ast_node).with_doc_opt(doc) |
55 | } | 53 | } |
56 | 54 | ||
57 | pub(crate) fn from_struct(db: &db::RootDatabase, st: hir::Struct) -> Option<Self> { | 55 | pub(crate) fn from_struct(db: &RootDatabase, st: hir::Struct) -> Option<Self> { |
58 | let node: ast::StructDef = st.source(db).value; | 56 | let node: ast::StructDef = st.source(db).value; |
59 | match node.kind() { | 57 | match node.kind() { |
60 | ast::StructKind::Record(_) => return None, | 58 | ast::StructKind::Record(_) => return None, |
@@ -86,10 +84,7 @@ impl FunctionSignature { | |||
86 | ) | 84 | ) |
87 | } | 85 | } |
88 | 86 | ||
89 | pub(crate) fn from_enum_variant( | 87 | pub(crate) fn from_enum_variant(db: &RootDatabase, variant: hir::EnumVariant) -> Option<Self> { |
90 | db: &db::RootDatabase, | ||
91 | variant: hir::EnumVariant, | ||
92 | ) -> Option<Self> { | ||
93 | let node: ast::EnumVariant = variant.source(db).value; | 88 | let node: ast::EnumVariant = variant.source(db).value; |
94 | match node.kind() { | 89 | match node.kind() { |
95 | ast::StructKind::Record(_) | ast::StructKind::Unit => return None, | 90 | ast::StructKind::Record(_) | ast::StructKind::Unit => return None, |
@@ -126,7 +121,7 @@ impl FunctionSignature { | |||
126 | ) | 121 | ) |
127 | } | 122 | } |
128 | 123 | ||
129 | pub(crate) fn from_macro(db: &db::RootDatabase, macro_def: hir::MacroDef) -> Option<Self> { | 124 | pub(crate) fn from_macro(db: &RootDatabase, macro_def: hir::MacroDef) -> Option<Self> { |
130 | let node: ast::MacroCall = macro_def.source(db).value; | 125 | let node: ast::MacroCall = macro_def.source(db).value; |
131 | 126 | ||
132 | let params = vec![]; | 127 | let params = vec![]; |
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index b2af3479c..906aab1eb 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs | |||
@@ -3,6 +3,7 @@ | |||
3 | use either::Either; | 3 | use either::Either; |
4 | use hir::{AssocItem, FieldSource, HasSource, InFile, ModuleSource}; | 4 | use hir::{AssocItem, FieldSource, HasSource, InFile, ModuleSource}; |
5 | use ra_db::{FileId, SourceDatabase}; | 5 | use ra_db::{FileId, SourceDatabase}; |
6 | use ra_ide_db::RootDatabase; | ||
6 | use ra_syntax::{ | 7 | use ra_syntax::{ |
7 | ast::{self, DocCommentsOwner, NameOwner}, | 8 | ast::{self, DocCommentsOwner, NameOwner}, |
8 | match_ast, AstNode, SmolStr, | 9 | match_ast, AstNode, SmolStr, |
@@ -10,7 +11,7 @@ use ra_syntax::{ | |||
10 | TextRange, | 11 | TextRange, |
11 | }; | 12 | }; |
12 | 13 | ||
13 | use crate::{db::RootDatabase, expand::original_range, FileSymbol}; | 14 | use crate::{expand::original_range, FileSymbol}; |
14 | 15 | ||
15 | use super::short_label::ShortLabel; | 16 | use super::short_label::ShortLabel; |
16 | 17 | ||
diff --git a/crates/ra_ide/src/expand.rs b/crates/ra_ide/src/expand.rs index 831438c09..9f3aaa3a3 100644 --- a/crates/ra_ide/src/expand.rs +++ b/crates/ra_ide/src/expand.rs | |||
@@ -3,9 +3,10 @@ use std::iter::successors; | |||
3 | 3 | ||
4 | use hir::{InFile, Origin}; | 4 | use hir::{InFile, Origin}; |
5 | use ra_db::FileId; | 5 | use ra_db::FileId; |
6 | use ra_ide_db::RootDatabase; | ||
6 | use ra_syntax::{ast, AstNode, SyntaxNode, SyntaxToken, TextRange}; | 7 | use ra_syntax::{ast, AstNode, SyntaxNode, SyntaxToken, TextRange}; |
7 | 8 | ||
8 | use crate::{db::RootDatabase, FileRange}; | 9 | use crate::FileRange; |
9 | 10 | ||
10 | pub(crate) fn original_range(db: &RootDatabase, node: InFile<&SyntaxNode>) -> FileRange { | 11 | pub(crate) fn original_range(db: &RootDatabase, node: InFile<&SyntaxNode>) -> FileRange { |
11 | if let Some((range, Origin::Call)) = original_range_and_origin(db, node) { | 12 | if let Some((range, Origin::Call)) = original_range_and_origin(db, node) { |
diff --git a/crates/ra_ide/src/expand_macro.rs b/crates/ra_ide/src/expand_macro.rs index 0f7b6e875..af2783bef 100644 --- a/crates/ra_ide/src/expand_macro.rs +++ b/crates/ra_ide/src/expand_macro.rs | |||
@@ -1,14 +1,15 @@ | |||
1 | //! This modules implements "expand macro" functionality in the IDE | 1 | //! This modules implements "expand macro" functionality in the IDE |
2 | 2 | ||
3 | use crate::{db::RootDatabase, FilePosition}; | ||
4 | use hir::db::AstDatabase; | 3 | use hir::db::AstDatabase; |
5 | use ra_db::SourceDatabase; | 4 | use ra_db::SourceDatabase; |
6 | use rustc_hash::FxHashMap; | 5 | use ra_ide_db::RootDatabase; |
7 | |||
8 | use ra_syntax::{ | 6 | use ra_syntax::{ |
9 | algo::{find_node_at_offset, replace_descendants}, | 7 | algo::{find_node_at_offset, replace_descendants}, |
10 | ast, AstNode, NodeOrToken, SyntaxElement, SyntaxKind, SyntaxNode, WalkEvent, T, | 8 | ast, AstNode, NodeOrToken, SyntaxElement, SyntaxKind, SyntaxNode, WalkEvent, T, |
11 | }; | 9 | }; |
10 | use rustc_hash::FxHashMap; | ||
11 | |||
12 | use crate::FilePosition; | ||
12 | 13 | ||
13 | pub struct ExpandedMacro { | 14 | pub struct ExpandedMacro { |
14 | pub name: String, | 15 | pub name: String, |
@@ -185,7 +186,7 @@ fn some_thing() -> u32 { | |||
185 | //- /lib.rs | 186 | //- /lib.rs |
186 | macro_rules! match_ast { | 187 | macro_rules! match_ast { |
187 | (match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) }; | 188 | (match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) }; |
188 | 189 | ||
189 | (match ($node:expr) { | 190 | (match ($node:expr) { |
190 | $( ast::$ast:ident($it:ident) => $res:block, )* | 191 | $( ast::$ast:ident($it:ident) => $res:block, )* |
191 | _ => $catch_all:expr $(,)? | 192 | _ => $catch_all:expr $(,)? |
@@ -193,7 +194,7 @@ fn some_thing() -> u32 { | |||
193 | $( if let Some($it) = ast::$ast::cast($node.clone()) $res else )* | 194 | $( if let Some($it) = ast::$ast::cast($node.clone()) $res else )* |
194 | { $catch_all } | 195 | { $catch_all } |
195 | }}; | 196 | }}; |
196 | } | 197 | } |
197 | 198 | ||
198 | fn main() { | 199 | fn main() { |
199 | mat<|>ch_ast! { | 200 | mat<|>ch_ast! { |
@@ -227,11 +228,11 @@ fn some_thing() -> u32 { | |||
227 | r#" | 228 | r#" |
228 | //- /lib.rs | 229 | //- /lib.rs |
229 | macro_rules! match_ast { | 230 | macro_rules! match_ast { |
230 | (match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) }; | 231 | (match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) }; |
231 | (match ($node:expr) {}) => {{}}; | 232 | (match ($node:expr) {}) => {{}}; |
232 | } | 233 | } |
233 | 234 | ||
234 | fn main() { | 235 | fn main() { |
235 | let p = f(|it| { | 236 | let p = f(|it| { |
236 | let res = mat<|>ch_ast! { match c {}}; | 237 | let res = mat<|>ch_ast! { match c {}}; |
237 | Some(res) | 238 | Some(res) |
@@ -254,9 +255,9 @@ fn some_thing() -> u32 { | |||
254 | } | 255 | } |
255 | macro_rules! foo { | 256 | macro_rules! foo { |
256 | () => {bar!()}; | 257 | () => {bar!()}; |
257 | } | 258 | } |
258 | 259 | ||
259 | fn main() { | 260 | fn main() { |
260 | let res = fo<|>o!(); | 261 | let res = fo<|>o!(); |
261 | } | 262 | } |
262 | "#, | 263 | "#, |
@@ -277,9 +278,9 @@ fn some_thing() -> u32 { | |||
277 | } | 278 | } |
278 | macro_rules! foo { | 279 | macro_rules! foo { |
279 | () => {$crate::bar!()}; | 280 | () => {$crate::bar!()}; |
280 | } | 281 | } |
281 | 282 | ||
282 | fn main() { | 283 | fn main() { |
283 | let res = fo<|>o!(); | 284 | let res = fo<|>o!(); |
284 | } | 285 | } |
285 | "#, | 286 | "#, |
diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index 930e0c4c2..726963a33 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs | |||
@@ -1,6 +1,10 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use std::iter::successors; | ||
4 | |||
5 | use hir::db::AstDatabase; | ||
3 | use ra_db::SourceDatabase; | 6 | use ra_db::SourceDatabase; |
7 | use ra_ide_db::RootDatabase; | ||
4 | use ra_syntax::{ | 8 | use ra_syntax::{ |
5 | algo::find_covering_element, | 9 | algo::find_covering_element, |
6 | ast::{self, AstNode, AstToken}, | 10 | ast::{self, AstNode, AstToken}, |
@@ -9,9 +13,7 @@ use ra_syntax::{ | |||
9 | SyntaxNode, SyntaxToken, TextRange, TextUnit, TokenAtOffset, T, | 13 | SyntaxNode, SyntaxToken, TextRange, TextUnit, TokenAtOffset, T, |
10 | }; | 14 | }; |
11 | 15 | ||
12 | use crate::{db::RootDatabase, expand::descend_into_macros, FileId, FileRange}; | 16 | use crate::{expand::descend_into_macros, FileId, FileRange}; |
13 | use hir::db::AstDatabase; | ||
14 | use std::iter::successors; | ||
15 | 17 | ||
16 | pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRange { | 18 | pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRange { |
17 | let src = db.parse(frange.file_id).tree(); | 19 | let src = db.parse(frange.file_id).tree(); |
@@ -512,8 +514,8 @@ fn bar(){} | |||
512 | fn test_extend_trait_bounds_list_in_where_clause() { | 514 | fn test_extend_trait_bounds_list_in_where_clause() { |
513 | do_check( | 515 | do_check( |
514 | r#" | 516 | r#" |
515 | fn foo<R>() | 517 | fn foo<R>() |
516 | where | 518 | where |
517 | R: req::Request + 'static, | 519 | R: req::Request + 'static, |
518 | R::Params: DeserializeOwned<|> + panic::UnwindSafe + 'static, | 520 | R::Params: DeserializeOwned<|> + panic::UnwindSafe + 'static, |
519 | R::Result: Serialize + 'static, | 521 | R::Result: Serialize + 'static, |
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index b67e32626..e9329a72c 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs | |||
@@ -1,6 +1,7 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use hir::{db::AstDatabase, InFile, SourceBinder}; | 3 | use hir::{db::AstDatabase, InFile, SourceBinder}; |
4 | use ra_ide_db::{symbol_index, RootDatabase}; | ||
4 | use ra_syntax::{ | 5 | use ra_syntax::{ |
5 | ast::{self, DocCommentsOwner}, | 6 | ast::{self, DocCommentsOwner}, |
6 | match_ast, AstNode, | 7 | match_ast, AstNode, |
@@ -9,10 +10,8 @@ use ra_syntax::{ | |||
9 | }; | 10 | }; |
10 | 11 | ||
11 | use crate::{ | 12 | use crate::{ |
12 | db::RootDatabase, | ||
13 | display::{ShortLabel, ToNav}, | 13 | display::{ShortLabel, ToNav}, |
14 | expand::descend_into_macros, | 14 | expand::descend_into_macros, |
15 | ide_db::symbol_index, | ||
16 | references::{classify_name_ref, NameKind::*}, | 15 | references::{classify_name_ref, NameKind::*}, |
17 | FilePosition, NavigationTarget, RangeInfo, | 16 | FilePosition, NavigationTarget, RangeInfo, |
18 | }; | 17 | }; |
diff --git a/crates/ra_ide/src/goto_type_definition.rs b/crates/ra_ide/src/goto_type_definition.rs index ce8b6c72a..11ad6d137 100644 --- a/crates/ra_ide/src/goto_type_definition.rs +++ b/crates/ra_ide/src/goto_type_definition.rs | |||
@@ -1,11 +1,11 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use hir::db::AstDatabase; | 3 | use hir::db::AstDatabase; |
4 | use ra_ide_db::RootDatabase; | ||
4 | use ra_syntax::{ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset}; | 5 | use ra_syntax::{ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset}; |
5 | 6 | ||
6 | use crate::{ | 7 | use crate::{ |
7 | db::RootDatabase, display::ToNav, expand::descend_into_macros, FilePosition, NavigationTarget, | 8 | display::ToNav, expand::descend_into_macros, FilePosition, NavigationTarget, RangeInfo, |
8 | RangeInfo, | ||
9 | }; | 9 | }; |
10 | 10 | ||
11 | pub(crate) fn goto_type_definition( | 11 | pub(crate) fn goto_type_definition( |
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 6661e5cb2..315b88190 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | use hir::{db::AstDatabase, Adt, HasSource, HirDisplay, SourceBinder}; | 3 | use hir::{db::AstDatabase, Adt, HasSource, HirDisplay, SourceBinder}; |
4 | use ra_db::SourceDatabase; | 4 | use ra_db::SourceDatabase; |
5 | use ra_ide_db::RootDatabase; | ||
5 | use ra_syntax::{ | 6 | use ra_syntax::{ |
6 | algo::find_covering_element, | 7 | algo::find_covering_element, |
7 | ast::{self, DocCommentsOwner}, | 8 | ast::{self, DocCommentsOwner}, |
@@ -11,7 +12,6 @@ use ra_syntax::{ | |||
11 | }; | 12 | }; |
12 | 13 | ||
13 | use crate::{ | 14 | use crate::{ |
14 | db::RootDatabase, | ||
15 | display::{macro_label, rust_code_markup, rust_code_markup_with_doc, ShortLabel}, | 15 | display::{macro_label, rust_code_markup, rust_code_markup_with_doc, ShortLabel}, |
16 | expand::descend_into_macros, | 16 | expand::descend_into_macros, |
17 | references::{classify_name, classify_name_ref, NameKind, NameKind::*}, | 17 | references::{classify_name, classify_name_ref, NameKind, NameKind::*}, |
diff --git a/crates/ra_ide/src/impls.rs b/crates/ra_ide/src/impls.rs index 9834025d3..64a2dadc8 100644 --- a/crates/ra_ide/src/impls.rs +++ b/crates/ra_ide/src/impls.rs | |||
@@ -2,9 +2,10 @@ | |||
2 | 2 | ||
3 | use hir::{Crate, ImplBlock, SourceBinder}; | 3 | use hir::{Crate, ImplBlock, SourceBinder}; |
4 | use ra_db::SourceDatabase; | 4 | use ra_db::SourceDatabase; |
5 | use ra_ide_db::RootDatabase; | ||
5 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; | 6 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; |
6 | 7 | ||
7 | use crate::{db::RootDatabase, display::ToNav, FilePosition, NavigationTarget, RangeInfo}; | 8 | use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; |
8 | 9 | ||
9 | pub(crate) fn goto_implementation( | 10 | pub(crate) fn goto_implementation( |
10 | db: &RootDatabase, | 11 | db: &RootDatabase, |
diff --git a/crates/ra_ide/src/imports_locator.rs b/crates/ra_ide/src/imports_locator.rs index 9e5e6cadf..cfd58aafe 100644 --- a/crates/ra_ide/src/imports_locator.rs +++ b/crates/ra_ide/src/imports_locator.rs | |||
@@ -1,17 +1,20 @@ | |||
1 | //! This module contains an import search funcionality that is provided to the ra_assists module. | 1 | //! This module contains an import search funcionality that is provided to the ra_assists module. |
2 | //! Later, this should be moved away to a separate crate that is accessible from the ra_assists module. | 2 | //! Later, this should be moved away to a separate crate that is accessible from the ra_assists module. |
3 | 3 | ||
4 | use crate::{ | ||
5 | db::RootDatabase, | ||
6 | ide_db::symbol_index::{self, FileSymbol}, | ||
7 | references::{classify_name, NameDefinition, NameKind}, | ||
8 | Query, | ||
9 | }; | ||
10 | use hir::{db::HirDatabase, ModuleDef, SourceBinder}; | 4 | use hir::{db::HirDatabase, ModuleDef, SourceBinder}; |
11 | use ra_assists::ImportsLocator; | 5 | use ra_assists::ImportsLocator; |
6 | use ra_ide_db::{ | ||
7 | symbol_index::{self, FileSymbol}, | ||
8 | RootDatabase, | ||
9 | }; | ||
12 | use ra_prof::profile; | 10 | use ra_prof::profile; |
13 | use ra_syntax::{ast, AstNode, SyntaxKind::NAME}; | 11 | use ra_syntax::{ast, AstNode, SyntaxKind::NAME}; |
14 | 12 | ||
13 | use crate::{ | ||
14 | references::{classify_name, NameDefinition, NameKind}, | ||
15 | Query, | ||
16 | }; | ||
17 | |||
15 | pub(crate) struct ImportsLocatorIde<'a> { | 18 | pub(crate) struct ImportsLocatorIde<'a> { |
16 | source_binder: SourceBinder<'a, RootDatabase>, | 19 | source_binder: SourceBinder<'a, RootDatabase>, |
17 | } | 20 | } |
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index de447a5aa..6b0d3d996 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -2,13 +2,14 @@ | |||
2 | 2 | ||
3 | use hir::{HirDisplay, SourceAnalyzer, SourceBinder}; | 3 | use hir::{HirDisplay, SourceAnalyzer, SourceBinder}; |
4 | use once_cell::unsync::Lazy; | 4 | use once_cell::unsync::Lazy; |
5 | use ra_ide_db::RootDatabase; | ||
5 | use ra_prof::profile; | 6 | use ra_prof::profile; |
6 | use ra_syntax::{ | 7 | use ra_syntax::{ |
7 | ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner}, | 8 | ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner}, |
8 | match_ast, SmolStr, SourceFile, SyntaxKind, SyntaxNode, TextRange, | 9 | match_ast, SmolStr, SourceFile, SyntaxKind, SyntaxNode, TextRange, |
9 | }; | 10 | }; |
10 | 11 | ||
11 | use crate::{db::RootDatabase, FileId, FunctionSignature}; | 12 | use crate::{FileId, FunctionSignature}; |
12 | 13 | ||
13 | #[derive(Debug, PartialEq, Eq)] | 14 | #[derive(Debug, PartialEq, Eq)] |
14 | pub enum InlayKind { | 15 | pub enum InlayKind { |
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 | ||
13 | mod ide_db { | ||
14 | pub use ra_ide_db::*; | ||
15 | } | ||
16 | |||
17 | mod db; | ||
18 | pub mod mock_analysis; | 13 | pub mod mock_analysis; |
19 | mod source_change; | 14 | mod 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 | }; |
54 | use ra_ide_db::{ | ||
55 | symbol_index::{self, FileSymbol}, | ||
56 | LineIndexDatabase, | ||
57 | }; | ||
59 | use ra_syntax::{SourceFile, TextRange, TextUnit}; | 58 | use ra_syntax::{SourceFile, TextRange, TextUnit}; |
60 | 59 | ||
61 | use crate::{ | 60 | use crate::display::ToNav; |
62 | db::LineIndexDatabase, | ||
63 | display::ToNav, | ||
64 | ide_db::symbol_index::{self, FileSymbol}, | ||
65 | }; | ||
66 | 61 | ||
67 | pub use crate::{ | 62 | pub 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; | |||
93 | pub use ra_db::{ | 81 | pub use ra_db::{ |
94 | Canceled, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRootId, | 82 | Canceled, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRootId, |
95 | }; | 83 | }; |
84 | pub 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 | ||
97 | pub type Cancelable<T> = Result<T, Canceled>; | 93 | pub 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)] |
130 | pub struct AnalysisHost { | 126 | pub struct AnalysisHost { |
131 | db: db::RootDatabase, | 127 | db: RootDatabase, |
132 | } | 128 | } |
133 | 129 | ||
134 | impl Default for AnalysisHost { | 130 | impl Default for AnalysisHost { |
@@ -139,7 +135,7 @@ impl Default for AnalysisHost { | |||
139 | 135 | ||
140 | impl AnalysisHost { | 136 | impl 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)] |
191 | pub struct Analysis { | 187 | pub 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> { |
diff --git a/crates/ra_ide/src/parent_module.rs b/crates/ra_ide/src/parent_module.rs index 2dbccfc3b..e0332da88 100644 --- a/crates/ra_ide/src/parent_module.rs +++ b/crates/ra_ide/src/parent_module.rs | |||
@@ -1,12 +1,13 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use ra_db::{CrateId, FileId, FilePosition, SourceDatabase}; | 3 | use ra_db::{CrateId, FileId, FilePosition, SourceDatabase}; |
4 | use ra_ide_db::RootDatabase; | ||
4 | use ra_syntax::{ | 5 | use ra_syntax::{ |
5 | algo::find_node_at_offset, | 6 | algo::find_node_at_offset, |
6 | ast::{self, AstNode}, | 7 | ast::{self, AstNode}, |
7 | }; | 8 | }; |
8 | 9 | ||
9 | use crate::{db::RootDatabase, NavigationTarget}; | 10 | use crate::NavigationTarget; |
10 | 11 | ||
11 | /// This returns `Vec` because a module may be included from several places. We | 12 | /// This returns `Vec` because a module may be included from several places. We |
12 | /// don't handle this case yet though, so the Vec has length at most one. | 13 | /// don't handle this case yet though, so the Vec has length at most one. |
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index ebded715d..b47f8bcd9 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs | |||
@@ -17,6 +17,7 @@ mod search_scope; | |||
17 | use hir::{InFile, SourceBinder}; | 17 | use hir::{InFile, SourceBinder}; |
18 | use once_cell::unsync::Lazy; | 18 | use once_cell::unsync::Lazy; |
19 | use ra_db::{SourceDatabase, SourceDatabaseExt}; | 19 | use ra_db::{SourceDatabase, SourceDatabaseExt}; |
20 | use ra_ide_db::RootDatabase; | ||
20 | use ra_prof::profile; | 21 | use ra_prof::profile; |
21 | use ra_syntax::{ | 22 | use ra_syntax::{ |
22 | algo::find_node_at_offset, | 23 | algo::find_node_at_offset, |
@@ -24,9 +25,7 @@ use ra_syntax::{ | |||
24 | match_ast, AstNode, SourceFile, SyntaxKind, SyntaxNode, TextRange, TextUnit, TokenAtOffset, | 25 | match_ast, AstNode, SourceFile, SyntaxKind, SyntaxNode, TextRange, TextUnit, TokenAtOffset, |
25 | }; | 26 | }; |
26 | 27 | ||
27 | use crate::{ | 28 | use crate::{display::ToNav, FilePosition, FileRange, NavigationTarget, RangeInfo}; |
28 | db::RootDatabase, display::ToNav, FilePosition, FileRange, NavigationTarget, RangeInfo, | ||
29 | }; | ||
30 | 29 | ||
31 | pub(crate) use self::{ | 30 | pub(crate) use self::{ |
32 | classify::{classify_name, classify_name_ref}, | 31 | classify::{classify_name, classify_name_ref}, |
diff --git a/crates/ra_ide/src/references/classify.rs b/crates/ra_ide/src/references/classify.rs index 46cba30a3..758ea4e8b 100644 --- a/crates/ra_ide/src/references/classify.rs +++ b/crates/ra_ide/src/references/classify.rs | |||
@@ -9,7 +9,7 @@ use super::{ | |||
9 | name_definition::{from_assoc_item, from_module_def, from_struct_field}, | 9 | name_definition::{from_assoc_item, from_module_def, from_struct_field}, |
10 | NameDefinition, NameKind, | 10 | NameDefinition, NameKind, |
11 | }; | 11 | }; |
12 | use crate::db::RootDatabase; | 12 | use ra_ide_db::RootDatabase; |
13 | 13 | ||
14 | pub(crate) fn classify_name( | 14 | pub(crate) fn classify_name( |
15 | sb: &mut SourceBinder<RootDatabase>, | 15 | sb: &mut SourceBinder<RootDatabase>, |
diff --git a/crates/ra_ide/src/references/name_definition.rs b/crates/ra_ide/src/references/name_definition.rs index 1e4226ab9..71565e6d3 100644 --- a/crates/ra_ide/src/references/name_definition.rs +++ b/crates/ra_ide/src/references/name_definition.rs | |||
@@ -9,7 +9,7 @@ use hir::{ | |||
9 | }; | 9 | }; |
10 | use ra_syntax::{ast, ast::VisibilityOwner}; | 10 | use ra_syntax::{ast, ast::VisibilityOwner}; |
11 | 11 | ||
12 | use crate::db::RootDatabase; | 12 | use ra_ide_db::RootDatabase; |
13 | 13 | ||
14 | #[derive(Debug, PartialEq, Eq)] | 14 | #[derive(Debug, PartialEq, Eq)] |
15 | pub enum NameKind { | 15 | pub enum NameKind { |
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index 9a84c1c88..08e77c01f 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs | |||
@@ -2,14 +2,14 @@ | |||
2 | 2 | ||
3 | use hir::ModuleSource; | 3 | use hir::ModuleSource; |
4 | use ra_db::{RelativePath, RelativePathBuf, SourceDatabase, SourceDatabaseExt}; | 4 | use ra_db::{RelativePath, RelativePathBuf, SourceDatabase, SourceDatabaseExt}; |
5 | use ra_ide_db::RootDatabase; | ||
5 | use ra_syntax::{ | 6 | use ra_syntax::{ |
6 | algo::find_node_at_offset, ast, lex_single_valid_syntax_kind, AstNode, SyntaxKind, SyntaxNode, | 7 | algo::find_node_at_offset, ast, lex_single_valid_syntax_kind, AstNode, SyntaxKind, SyntaxNode, |
7 | }; | 8 | }; |
8 | use ra_text_edit::TextEdit; | 9 | use ra_text_edit::TextEdit; |
9 | 10 | ||
10 | use crate::{ | 11 | use crate::{ |
11 | db::RootDatabase, FileId, FilePosition, FileSystemEdit, RangeInfo, SourceChange, | 12 | FileId, FilePosition, FileSystemEdit, RangeInfo, SourceChange, SourceFileEdit, TextRange, |
12 | SourceFileEdit, TextRange, | ||
13 | }; | 13 | }; |
14 | 14 | ||
15 | use super::find_all_refs; | 15 | use super::find_all_refs; |
diff --git a/crates/ra_ide/src/references/search_scope.rs b/crates/ra_ide/src/references/search_scope.rs index f8211a746..97c65c2cd 100644 --- a/crates/ra_ide/src/references/search_scope.rs +++ b/crates/ra_ide/src/references/search_scope.rs | |||
@@ -10,7 +10,7 @@ use ra_prof::profile; | |||
10 | use ra_syntax::{AstNode, TextRange}; | 10 | use ra_syntax::{AstNode, TextRange}; |
11 | use rustc_hash::FxHashMap; | 11 | use rustc_hash::FxHashMap; |
12 | 12 | ||
13 | use crate::db::RootDatabase; | 13 | use ra_ide_db::RootDatabase; |
14 | 14 | ||
15 | use super::{NameDefinition, NameKind}; | 15 | use super::{NameDefinition, NameKind}; |
16 | 16 | ||
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs index 8622dd956..b6b0c70f9 100644 --- a/crates/ra_ide/src/runnables.rs +++ b/crates/ra_ide/src/runnables.rs | |||
@@ -3,12 +3,13 @@ | |||
3 | use hir::InFile; | 3 | use hir::InFile; |
4 | use itertools::Itertools; | 4 | use itertools::Itertools; |
5 | use ra_db::SourceDatabase; | 5 | use ra_db::SourceDatabase; |
6 | use ra_ide_db::RootDatabase; | ||
6 | use ra_syntax::{ | 7 | use ra_syntax::{ |
7 | ast::{self, AstNode, AttrsOwner, ModuleItemOwner, NameOwner}, | 8 | ast::{self, AstNode, AttrsOwner, ModuleItemOwner, NameOwner}, |
8 | match_ast, SyntaxNode, TextRange, | 9 | match_ast, SyntaxNode, TextRange, |
9 | }; | 10 | }; |
10 | 11 | ||
11 | use crate::{db::RootDatabase, FileId}; | 12 | use crate::FileId; |
12 | 13 | ||
13 | #[derive(Debug)] | 14 | #[derive(Debug)] |
14 | pub struct Runnable { | 15 | pub struct Runnable { |
diff --git a/crates/ra_ide/src/status.rs b/crates/ra_ide/src/status.rs index 538312086..30eb5c995 100644 --- a/crates/ra_ide/src/status.rs +++ b/crates/ra_ide/src/status.rs | |||
@@ -10,14 +10,14 @@ use ra_db::{ | |||
10 | }, | 10 | }, |
11 | FileTextQuery, SourceRootId, | 11 | FileTextQuery, SourceRootId, |
12 | }; | 12 | }; |
13 | use ra_ide_db::{ | ||
14 | symbol_index::{LibrarySymbolsQuery, SymbolIndex}, | ||
15 | RootDatabase, | ||
16 | }; | ||
13 | use ra_prof::{memory_usage, Bytes}; | 17 | use ra_prof::{memory_usage, Bytes}; |
14 | use ra_syntax::{ast, Parse, SyntaxNode}; | 18 | use ra_syntax::{ast, Parse, SyntaxNode}; |
15 | 19 | ||
16 | use crate::{ | 20 | use crate::FileId; |
17 | db::RootDatabase, | ||
18 | ide_db::symbol_index::{LibrarySymbolsQuery, SymbolIndex}, | ||
19 | FileId, | ||
20 | }; | ||
21 | 21 | ||
22 | fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { | 22 | fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { |
23 | db.query(ra_db::ParseQuery).entries::<SyntaxTreeStats>() | 23 | db.query(ra_db::ParseQuery).entries::<SyntaxTreeStats>() |
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 530b984fc..c5d249fe8 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -4,6 +4,7 @@ use rustc_hash::FxHashMap; | |||
4 | 4 | ||
5 | use hir::{HirFileId, InFile, Name, SourceAnalyzer, SourceBinder}; | 5 | use hir::{HirFileId, InFile, Name, SourceAnalyzer, SourceBinder}; |
6 | use ra_db::SourceDatabase; | 6 | use ra_db::SourceDatabase; |
7 | use ra_ide_db::RootDatabase; | ||
7 | use ra_prof::profile; | 8 | use ra_prof::profile; |
8 | use ra_syntax::{ | 9 | use ra_syntax::{ |
9 | ast, AstNode, Direction, SyntaxElement, SyntaxKind, SyntaxKind::*, SyntaxToken, TextRange, | 10 | ast, AstNode, Direction, SyntaxElement, SyntaxKind, SyntaxKind::*, SyntaxToken, TextRange, |
@@ -11,7 +12,6 @@ use ra_syntax::{ | |||
11 | }; | 12 | }; |
12 | 13 | ||
13 | use crate::{ | 14 | use crate::{ |
14 | db::RootDatabase, | ||
15 | expand::descend_into_macros_with_analyzer, | 15 | expand::descend_into_macros_with_analyzer, |
16 | references::{ | 16 | references::{ |
17 | classify_name, classify_name_ref, | 17 | classify_name, classify_name_ref, |
diff --git a/crates/ra_ide/src/syntax_tree.rs b/crates/ra_ide/src/syntax_tree.rs index 4d0f0fc47..55966daf3 100644 --- a/crates/ra_ide/src/syntax_tree.rs +++ b/crates/ra_ide/src/syntax_tree.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use crate::db::RootDatabase; | ||
4 | use ra_db::SourceDatabase; | 3 | use ra_db::SourceDatabase; |
4 | use ra_ide_db::RootDatabase; | ||
5 | use ra_syntax::{ | 5 | use ra_syntax::{ |
6 | algo, AstNode, NodeOrToken, SourceFile, | 6 | algo, AstNode, NodeOrToken, SourceFile, |
7 | SyntaxKind::{RAW_STRING, STRING}, | 7 | SyntaxKind::{RAW_STRING, STRING}, |
diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs index 21e5be9b3..e5d1779fd 100644 --- a/crates/ra_ide/src/typing.rs +++ b/crates/ra_ide/src/typing.rs | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | use ra_db::{FilePosition, SourceDatabase}; | 16 | use ra_db::{FilePosition, SourceDatabase}; |
17 | use ra_fmt::leading_indent; | 17 | use ra_fmt::leading_indent; |
18 | use ra_ide_db::RootDatabase; | ||
18 | use ra_syntax::{ | 19 | use ra_syntax::{ |
19 | algo::find_node_at_offset, | 20 | algo::find_node_at_offset, |
20 | ast::{self, AstToken}, | 21 | ast::{self, AstToken}, |
@@ -24,7 +25,7 @@ use ra_syntax::{ | |||
24 | }; | 25 | }; |
25 | use ra_text_edit::TextEdit; | 26 | use ra_text_edit::TextEdit; |
26 | 27 | ||
27 | use crate::{db::RootDatabase, source_change::SingleFileChange, SourceChange, SourceFileEdit}; | 28 | use crate::{source_change::SingleFileChange, SourceChange, SourceFileEdit}; |
28 | 29 | ||
29 | pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<SourceChange> { | 30 | pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<SourceChange> { |
30 | let parse = db.parse(position.file_id); | 31 | let parse = db.parse(position.file_id); |
diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ra_ide_db/src/symbol_index.rs index 33f042d88..436b4497f 100644 --- a/crates/ra_ide_db/src/symbol_index.rs +++ b/crates/ra_ide_db/src/symbol_index.rs | |||
@@ -370,7 +370,8 @@ fn to_file_symbol(node: &SyntaxNode, file_id: FileId) -> Option<FileSymbol> { | |||
370 | }) | 370 | }) |
371 | } | 371 | } |
372 | 372 | ||
373 | #[cfg(test)] | 373 | // TODO: fix this |
374 | #[cfg(never)] | ||
374 | mod tests { | 375 | mod tests { |
375 | use crate::{display::NavigationTarget, mock_analysis::single_file, Query}; | 376 | use crate::{display::NavigationTarget, mock_analysis::single_file, Query}; |
376 | use ra_syntax::{ | 377 | use ra_syntax::{ |