diff options
author | Igor Aleksanov <[email protected]> | 2020-10-24 09:39:57 +0100 |
---|---|---|
committer | Igor Aleksanov <[email protected]> | 2020-10-24 09:39:57 +0100 |
commit | 19cce08662222f012a0f50ff73afd4fdd34ca683 (patch) | |
tree | 6561f9a2802caff7b5fe56eeaa0c751bc5015a91 | |
parent | 2c787676c92c81a0c9efeb3e72a91c5132c8106a (diff) |
Re-export base_db from ide_db
52 files changed, 69 insertions, 74 deletions
diff --git a/Cargo.lock b/Cargo.lock index bc0f0862d..769120fc2 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -50,7 +50,6 @@ checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" | |||
50 | name = "assists" | 50 | name = "assists" |
51 | version = "0.0.0" | 51 | version = "0.0.0" |
52 | dependencies = [ | 52 | dependencies = [ |
53 | "base_db", | ||
54 | "either", | 53 | "either", |
55 | "hir", | 54 | "hir", |
56 | "ide_db", | 55 | "ide_db", |
@@ -627,7 +626,6 @@ name = "ide" | |||
627 | version = "0.0.0" | 626 | version = "0.0.0" |
628 | dependencies = [ | 627 | dependencies = [ |
629 | "assists", | 628 | "assists", |
630 | "base_db", | ||
631 | "cfg", | 629 | "cfg", |
632 | "completion", | 630 | "completion", |
633 | "either", | 631 | "either", |
@@ -1315,7 +1313,6 @@ name = "rust-analyzer" | |||
1315 | version = "0.0.0" | 1313 | version = "0.0.0" |
1316 | dependencies = [ | 1314 | dependencies = [ |
1317 | "anyhow", | 1315 | "anyhow", |
1318 | "base_db", | ||
1319 | "cfg", | 1316 | "cfg", |
1320 | "crossbeam-channel 0.5.0", | 1317 | "crossbeam-channel 0.5.0", |
1321 | "env_logger", | 1318 | "env_logger", |
@@ -1548,7 +1545,6 @@ dependencies = [ | |||
1548 | name = "ssr" | 1545 | name = "ssr" |
1549 | version = "0.0.0" | 1546 | version = "0.0.0" |
1550 | dependencies = [ | 1547 | dependencies = [ |
1551 | "base_db", | ||
1552 | "expect-test", | 1548 | "expect-test", |
1553 | "hir", | 1549 | "hir", |
1554 | "ide_db", | 1550 | "ide_db", |
diff --git a/crates/assists/Cargo.toml b/crates/assists/Cargo.toml index 264125651..108f656e9 100644 --- a/crates/assists/Cargo.toml +++ b/crates/assists/Cargo.toml | |||
@@ -18,7 +18,6 @@ stdx = { path = "../stdx", version = "0.0.0" } | |||
18 | syntax = { path = "../syntax", version = "0.0.0" } | 18 | syntax = { path = "../syntax", version = "0.0.0" } |
19 | text_edit = { path = "../text_edit", version = "0.0.0" } | 19 | text_edit = { path = "../text_edit", version = "0.0.0" } |
20 | profile = { path = "../profile", version = "0.0.0" } | 20 | profile = { path = "../profile", version = "0.0.0" } |
21 | base_db = { path = "../base_db", version = "0.0.0" } | ||
22 | ide_db = { path = "../ide_db", version = "0.0.0" } | 21 | ide_db = { path = "../ide_db", version = "0.0.0" } |
23 | hir = { path = "../hir", version = "0.0.0" } | 22 | hir = { path = "../hir", version = "0.0.0" } |
24 | test_utils = { path = "../test_utils", version = "0.0.0" } | 23 | test_utils = { path = "../test_utils", version = "0.0.0" } |
diff --git a/crates/assists/src/assist_context.rs b/crates/assists/src/assist_context.rs index bf520069e..d11fee196 100644 --- a/crates/assists/src/assist_context.rs +++ b/crates/assists/src/assist_context.rs | |||
@@ -3,8 +3,8 @@ | |||
3 | use std::mem; | 3 | use std::mem; |
4 | 4 | ||
5 | use algo::find_covering_element; | 5 | use algo::find_covering_element; |
6 | use base_db::{FileId, FileRange}; | ||
7 | use hir::Semantics; | 6 | use hir::Semantics; |
7 | use ide_db::base_db::{FileId, FileRange}; | ||
8 | use ide_db::{ | 8 | use ide_db::{ |
9 | label::Label, | 9 | label::Label, |
10 | source_change::{SourceChange, SourceFileEdit}, | 10 | source_change::{SourceChange, SourceFileEdit}, |
diff --git a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs index 7f4f80b23..48433feb9 100644 --- a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use base_db::FileId; | ||
2 | use hir::{EnumVariant, Module, ModuleDef, Name}; | 1 | use hir::{EnumVariant, Module, ModuleDef, Name}; |
2 | use ide_db::base_db::FileId; | ||
3 | use ide_db::{defs::Definition, search::Reference, RootDatabase}; | 3 | use ide_db::{defs::Definition, search::Reference, RootDatabase}; |
4 | use itertools::Itertools; | 4 | use itertools::Itertools; |
5 | use rustc_hash::FxHashSet; | 5 | use rustc_hash::FxHashSet; |
diff --git a/crates/assists/src/handlers/fix_visibility.rs b/crates/assists/src/handlers/fix_visibility.rs index 66f74150c..c86720787 100644 --- a/crates/assists/src/handlers/fix_visibility.rs +++ b/crates/assists/src/handlers/fix_visibility.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use base_db::FileId; | ||
2 | use hir::{db::HirDatabase, HasSource, HasVisibility, PathResolution}; | 1 | use hir::{db::HirDatabase, HasSource, HasVisibility, PathResolution}; |
2 | use ide_db::base_db::FileId; | ||
3 | use syntax::{ | 3 | use syntax::{ |
4 | ast::{self, VisibilityOwner}, | 4 | ast::{self, VisibilityOwner}, |
5 | AstNode, TextRange, TextSize, | 5 | AstNode, TextRange, TextSize, |
diff --git a/crates/assists/src/handlers/generate_function.rs b/crates/assists/src/handlers/generate_function.rs index d23f4293b..758188a42 100644 --- a/crates/assists/src/handlers/generate_function.rs +++ b/crates/assists/src/handlers/generate_function.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use base_db::FileId; | ||
2 | use hir::HirDisplay; | 1 | use hir::HirDisplay; |
2 | use ide_db::base_db::FileId; | ||
3 | use rustc_hash::{FxHashMap, FxHashSet}; | 3 | use rustc_hash::{FxHashMap, FxHashSet}; |
4 | use syntax::{ | 4 | use syntax::{ |
5 | ast::{ | 5 | ast::{ |
diff --git a/crates/assists/src/lib.rs b/crates/assists/src/lib.rs index 8a664f654..70a651e10 100644 --- a/crates/assists/src/lib.rs +++ b/crates/assists/src/lib.rs | |||
@@ -17,8 +17,8 @@ mod tests; | |||
17 | pub mod utils; | 17 | pub mod utils; |
18 | pub mod ast_transform; | 18 | pub mod ast_transform; |
19 | 19 | ||
20 | use base_db::FileRange; | ||
21 | use hir::Semantics; | 20 | use hir::Semantics; |
21 | use ide_db::base_db::FileRange; | ||
22 | use ide_db::{label::Label, source_change::SourceChange, RootDatabase}; | 22 | use ide_db::{label::Label, source_change::SourceChange, RootDatabase}; |
23 | use syntax::TextRange; | 23 | use syntax::TextRange; |
24 | 24 | ||
diff --git a/crates/assists/src/tests.rs b/crates/assists/src/tests.rs index 2b687decf..849d85e76 100644 --- a/crates/assists/src/tests.rs +++ b/crates/assists/src/tests.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | mod generated; | 1 | mod generated; |
2 | 2 | ||
3 | use base_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; | ||
4 | use hir::Semantics; | 3 | use hir::Semantics; |
4 | use ide_db::base_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; | ||
5 | use ide_db::RootDatabase; | 5 | use ide_db::RootDatabase; |
6 | use syntax::TextRange; | 6 | use syntax::TextRange; |
7 | use test_utils::{assert_eq_text, extract_offset, extract_range}; | 7 | use test_utils::{assert_eq_text, extract_offset, extract_range}; |
diff --git a/crates/completion/src/complete_mod.rs b/crates/completion/src/complete_mod.rs index 35a57aba3..385911afa 100644 --- a/crates/completion/src/complete_mod.rs +++ b/crates/completion/src/complete_mod.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Completes mod declarations. | 1 | //! Completes mod declarations. |
2 | 2 | ||
3 | use base_db::{SourceDatabaseExt, VfsPath}; | ||
4 | use hir::{Module, ModuleSource}; | 3 | use hir::{Module, ModuleSource}; |
4 | use ide_db::base_db::{SourceDatabaseExt, VfsPath}; | ||
5 | use ide_db::RootDatabase; | 5 | use ide_db::RootDatabase; |
6 | use rustc_hash::FxHashSet; | 6 | use rustc_hash::FxHashSet; |
7 | 7 | ||
diff --git a/crates/completion/src/completion_context.rs b/crates/completion/src/completion_context.rs index 97c5c04ba..dca304a8f 100644 --- a/crates/completion/src/completion_context.rs +++ b/crates/completion/src/completion_context.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! See `CompletionContext` structure. | 1 | //! See `CompletionContext` structure. |
2 | 2 | ||
3 | use base_db::{FilePosition, SourceDatabase}; | ||
4 | use hir::{Local, ScopeDef, Semantics, SemanticsScope, Type}; | 3 | use hir::{Local, ScopeDef, Semantics, SemanticsScope, Type}; |
4 | use ide_db::base_db::{FilePosition, SourceDatabase}; | ||
5 | use ide_db::{call_info::ActiveParameter, RootDatabase}; | 5 | use ide_db::{call_info::ActiveParameter, RootDatabase}; |
6 | use syntax::{ | 6 | use syntax::{ |
7 | algo::{find_covering_element, find_node_at_offset}, | 7 | algo::{find_covering_element, find_node_at_offset}, |
diff --git a/crates/completion/src/lib.rs b/crates/completion/src/lib.rs index 0a60ea7f2..b72fd249d 100644 --- a/crates/completion/src/lib.rs +++ b/crates/completion/src/lib.rs | |||
@@ -23,7 +23,7 @@ mod complete_macro_in_item_position; | |||
23 | mod complete_trait_impl; | 23 | mod complete_trait_impl; |
24 | mod complete_mod; | 24 | mod complete_mod; |
25 | 25 | ||
26 | use base_db::FilePosition; | 26 | use ide_db::base_db::FilePosition; |
27 | use ide_db::RootDatabase; | 27 | use ide_db::RootDatabase; |
28 | 28 | ||
29 | use crate::{ | 29 | use crate::{ |
diff --git a/crates/completion/src/test_utils.rs b/crates/completion/src/test_utils.rs index f2cf2561f..b02556797 100644 --- a/crates/completion/src/test_utils.rs +++ b/crates/completion/src/test_utils.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Runs completion for testing purposes. | 1 | //! Runs completion for testing purposes. |
2 | 2 | ||
3 | use base_db::{fixture::ChangeFixture, FileLoader, FilePosition}; | ||
4 | use hir::Semantics; | 3 | use hir::Semantics; |
4 | use ide_db::base_db::{fixture::ChangeFixture, FileLoader, FilePosition}; | ||
5 | use ide_db::RootDatabase; | 5 | use ide_db::RootDatabase; |
6 | use itertools::Itertools; | 6 | use itertools::Itertools; |
7 | use stdx::{format_to, trim_indent}; | 7 | use stdx::{format_to, trim_indent}; |
diff --git a/crates/ide/Cargo.toml b/crates/ide/Cargo.toml index 145c6156c..4d483580d 100644 --- a/crates/ide/Cargo.toml +++ b/crates/ide/Cargo.toml | |||
@@ -23,7 +23,6 @@ url = "2.1.1" | |||
23 | stdx = { path = "../stdx", version = "0.0.0" } | 23 | stdx = { path = "../stdx", version = "0.0.0" } |
24 | syntax = { path = "../syntax", version = "0.0.0" } | 24 | syntax = { path = "../syntax", version = "0.0.0" } |
25 | text_edit = { path = "../text_edit", version = "0.0.0" } | 25 | text_edit = { path = "../text_edit", version = "0.0.0" } |
26 | base_db = { path = "../base_db", version = "0.0.0" } | ||
27 | ide_db = { path = "../ide_db", version = "0.0.0" } | 26 | ide_db = { path = "../ide_db", version = "0.0.0" } |
28 | cfg = { path = "../cfg", version = "0.0.0" } | 27 | cfg = { path = "../cfg", version = "0.0.0" } |
29 | profile = { path = "../profile", version = "0.0.0" } | 28 | profile = { path = "../profile", version = "0.0.0" } |
diff --git a/crates/ide/src/call_hierarchy.rs b/crates/ide/src/call_hierarchy.rs index a259d9849..8ad50a2ee 100644 --- a/crates/ide/src/call_hierarchy.rs +++ b/crates/ide/src/call_hierarchy.rs | |||
@@ -137,7 +137,7 @@ impl CallLocations { | |||
137 | 137 | ||
138 | #[cfg(test)] | 138 | #[cfg(test)] |
139 | mod tests { | 139 | mod tests { |
140 | use base_db::FilePosition; | 140 | use ide_db::base_db::FilePosition; |
141 | 141 | ||
142 | use crate::fixture; | 142 | use crate::fixture; |
143 | 143 | ||
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs index 232074c3d..d0ee58858 100644 --- a/crates/ide/src/diagnostics.rs +++ b/crates/ide/src/diagnostics.rs | |||
@@ -9,11 +9,11 @@ mod field_shorthand; | |||
9 | 9 | ||
10 | use std::cell::RefCell; | 10 | use std::cell::RefCell; |
11 | 11 | ||
12 | use base_db::SourceDatabase; | ||
13 | use hir::{ | 12 | use hir::{ |
14 | diagnostics::{Diagnostic as _, DiagnosticSinkBuilder}, | 13 | diagnostics::{Diagnostic as _, DiagnosticSinkBuilder}, |
15 | Semantics, | 14 | Semantics, |
16 | }; | 15 | }; |
16 | use ide_db::base_db::SourceDatabase; | ||
17 | use ide_db::RootDatabase; | 17 | use ide_db::RootDatabase; |
18 | use itertools::Itertools; | 18 | use itertools::Itertools; |
19 | use rustc_hash::FxHashSet; | 19 | use rustc_hash::FxHashSet; |
diff --git a/crates/ide/src/diagnostics/field_shorthand.rs b/crates/ide/src/diagnostics/field_shorthand.rs index 54e9fce9e..f41bcd619 100644 --- a/crates/ide/src/diagnostics/field_shorthand.rs +++ b/crates/ide/src/diagnostics/field_shorthand.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Suggests shortening `Foo { field: field }` to `Foo { field }` in both | 1 | //! Suggests shortening `Foo { field: field }` to `Foo { field }` in both |
2 | //! expressions and patterns. | 2 | //! expressions and patterns. |
3 | 3 | ||
4 | use base_db::FileId; | 4 | use ide_db::base_db::FileId; |
5 | use ide_db::source_change::SourceFileEdit; | 5 | use ide_db::source_change::SourceFileEdit; |
6 | use syntax::{ast, match_ast, AstNode, SyntaxNode}; | 6 | use syntax::{ast, match_ast, AstNode, SyntaxNode}; |
7 | use text_edit::TextEdit; | 7 | use text_edit::TextEdit; |
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs index 0c75e50b0..0c950003e 100644 --- a/crates/ide/src/diagnostics/fixes.rs +++ b/crates/ide/src/diagnostics/fixes.rs | |||
@@ -1,6 +1,5 @@ | |||
1 | //! Provides a way to attach fixes to the diagnostics. | 1 | //! Provides a way to attach fixes to the diagnostics. |
2 | //! The same module also has all curret custom fixes for the diagnostics implemented. | 2 | //! The same module also has all curret custom fixes for the diagnostics implemented. |
3 | use base_db::FileId; | ||
4 | use hir::{ | 3 | use hir::{ |
5 | db::AstDatabase, | 4 | db::AstDatabase, |
6 | diagnostics::{ | 5 | diagnostics::{ |
@@ -9,6 +8,7 @@ use hir::{ | |||
9 | }, | 8 | }, |
10 | HasSource, HirDisplay, Semantics, VariantDef, | 9 | HasSource, HirDisplay, Semantics, VariantDef, |
11 | }; | 10 | }; |
11 | use ide_db::base_db::FileId; | ||
12 | use ide_db::{ | 12 | use ide_db::{ |
13 | source_change::{FileSystemEdit, SourceFileEdit}, | 13 | source_change::{FileSystemEdit, SourceFileEdit}, |
14 | RootDatabase, | 14 | RootDatabase, |
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index cf9d617dc..0c429a262 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use base_db::{FileId, SourceDatabase}; | ||
4 | use either::Either; | 3 | use either::Either; |
5 | use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource}; | 4 | use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource}; |
5 | use ide_db::base_db::{FileId, SourceDatabase}; | ||
6 | use ide_db::{defs::Definition, RootDatabase}; | 6 | use ide_db::{defs::Definition, RootDatabase}; |
7 | use syntax::{ | 7 | use syntax::{ |
8 | ast::{self, DocCommentsOwner, NameOwner}, | 8 | ast::{self, DocCommentsOwner, NameOwner}, |
diff --git a/crates/ide/src/fixture.rs b/crates/ide/src/fixture.rs index ed06689f0..eb57f9224 100644 --- a/crates/ide/src/fixture.rs +++ b/crates/ide/src/fixture.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | //! Utilities for creating `Analysis` instances for tests. | 1 | //! Utilities for creating `Analysis` instances for tests. |
2 | use base_db::fixture::ChangeFixture; | 2 | use ide_db::base_db::fixture::ChangeFixture; |
3 | use test_utils::{extract_annotations, RangeOrOffset}; | 3 | use test_utils::{extract_annotations, RangeOrOffset}; |
4 | 4 | ||
5 | use crate::{Analysis, AnalysisHost, FileId, FilePosition, FileRange}; | 5 | use crate::{Analysis, AnalysisHost, FileId, FilePosition, FileRange}; |
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index a87e31019..15792f947 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs | |||
@@ -100,7 +100,7 @@ pub(crate) fn reference_definition( | |||
100 | 100 | ||
101 | #[cfg(test)] | 101 | #[cfg(test)] |
102 | mod tests { | 102 | mod tests { |
103 | use base_db::FileRange; | 103 | use ide_db::base_db::FileRange; |
104 | use syntax::{TextRange, TextSize}; | 104 | use syntax::{TextRange, TextSize}; |
105 | 105 | ||
106 | use crate::fixture; | 106 | use crate::fixture; |
diff --git a/crates/ide/src/goto_implementation.rs b/crates/ide/src/goto_implementation.rs index 6c586bbd1..529004878 100644 --- a/crates/ide/src/goto_implementation.rs +++ b/crates/ide/src/goto_implementation.rs | |||
@@ -74,7 +74,7 @@ fn impls_for_trait( | |||
74 | 74 | ||
75 | #[cfg(test)] | 75 | #[cfg(test)] |
76 | mod tests { | 76 | mod tests { |
77 | use base_db::FileRange; | 77 | use ide_db::base_db::FileRange; |
78 | 78 | ||
79 | use crate::fixture; | 79 | use crate::fixture; |
80 | 80 | ||
diff --git a/crates/ide/src/goto_type_definition.rs b/crates/ide/src/goto_type_definition.rs index 6d0df04dd..aba6bf5dc 100644 --- a/crates/ide/src/goto_type_definition.rs +++ b/crates/ide/src/goto_type_definition.rs | |||
@@ -54,7 +54,7 @@ fn pick_best(tokens: TokenAtOffset<SyntaxToken>) -> Option<SyntaxToken> { | |||
54 | 54 | ||
55 | #[cfg(test)] | 55 | #[cfg(test)] |
56 | mod tests { | 56 | mod tests { |
57 | use base_db::FileRange; | 57 | use ide_db::base_db::FileRange; |
58 | 58 | ||
59 | use crate::fixture; | 59 | use crate::fixture; |
60 | 60 | ||
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 0332c7be0..94d895c5e 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | use base_db::SourceDatabase; | ||
2 | use hir::{ | 1 | use hir::{ |
3 | Adt, AsAssocItem, AssocItemContainer, Documentation, FieldSource, HasSource, HirDisplay, | 2 | Adt, AsAssocItem, AssocItemContainer, Documentation, FieldSource, HasSource, HirDisplay, |
4 | Module, ModuleDef, ModuleSource, Semantics, | 3 | Module, ModuleDef, ModuleSource, Semantics, |
5 | }; | 4 | }; |
5 | use ide_db::base_db::SourceDatabase; | ||
6 | use ide_db::{ | 6 | use ide_db::{ |
7 | defs::{Definition, NameClass, NameRefClass}, | 7 | defs::{Definition, NameClass, NameRefClass}, |
8 | RootDatabase, | 8 | RootDatabase, |
@@ -385,8 +385,8 @@ fn pick_best(tokens: TokenAtOffset<SyntaxToken>) -> Option<SyntaxToken> { | |||
385 | 385 | ||
386 | #[cfg(test)] | 386 | #[cfg(test)] |
387 | mod tests { | 387 | mod tests { |
388 | use base_db::FileLoader; | ||
389 | use expect_test::{expect, Expect}; | 388 | use expect_test::{expect, Expect}; |
389 | use ide_db::base_db::FileLoader; | ||
390 | 390 | ||
391 | use crate::fixture; | 391 | use crate::fixture; |
392 | 392 | ||
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index d84b970d4..4bc733b70 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs | |||
@@ -48,11 +48,11 @@ mod doc_links; | |||
48 | 48 | ||
49 | use std::sync::Arc; | 49 | use std::sync::Arc; |
50 | 50 | ||
51 | use base_db::{ | 51 | use cfg::CfgOptions; |
52 | use ide_db::base_db::{ | ||
52 | salsa::{self, ParallelDatabase}, | 53 | salsa::{self, ParallelDatabase}, |
53 | CheckCanceled, Env, FileLoader, FileSet, SourceDatabase, VfsPath, | 54 | CheckCanceled, Env, FileLoader, FileSet, SourceDatabase, VfsPath, |
54 | }; | 55 | }; |
55 | use cfg::CfgOptions; | ||
56 | use ide_db::{ | 56 | use ide_db::{ |
57 | symbol_index::{self, FileSymbol}, | 57 | symbol_index::{self, FileSymbol}, |
58 | LineIndexDatabase, | 58 | LineIndexDatabase, |
@@ -88,11 +88,11 @@ pub use ide_db::call_info::CallInfo; | |||
88 | pub use assists::{ | 88 | pub use assists::{ |
89 | utils::MergeBehaviour, Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist, | 89 | utils::MergeBehaviour, Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist, |
90 | }; | 90 | }; |
91 | pub use base_db::{ | 91 | pub use hir::{Documentation, Semantics}; |
92 | pub use ide_db::base_db::{ | ||
92 | Canceled, Change, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRoot, | 93 | Canceled, Change, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRoot, |
93 | SourceRootId, | 94 | SourceRootId, |
94 | }; | 95 | }; |
95 | pub use hir::{Documentation, Semantics}; | ||
96 | pub use ide_db::{ | 96 | pub use ide_db::{ |
97 | label::Label, | 97 | label::Label, |
98 | line_index::{LineCol, LineIndex}, | 98 | line_index::{LineCol, LineIndex}, |
diff --git a/crates/ide/src/parent_module.rs b/crates/ide/src/parent_module.rs index ef94acfec..6cc3b2991 100644 --- a/crates/ide/src/parent_module.rs +++ b/crates/ide/src/parent_module.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use base_db::{CrateId, FileId, FilePosition}; | ||
2 | use hir::Semantics; | 1 | use hir::Semantics; |
2 | use ide_db::base_db::{CrateId, FileId, FilePosition}; | ||
3 | use ide_db::RootDatabase; | 3 | use ide_db::RootDatabase; |
4 | use syntax::{ | 4 | use syntax::{ |
5 | algo::find_node_at_offset, | 5 | algo::find_node_at_offset, |
diff --git a/crates/ide/src/prime_caches.rs b/crates/ide/src/prime_caches.rs index 6944dbcd2..ea0acfaa0 100644 --- a/crates/ide/src/prime_caches.rs +++ b/crates/ide/src/prime_caches.rs | |||
@@ -3,8 +3,8 @@ | |||
3 | //! request takes longer to compute. This modules implemented prepopulating of | 3 | //! request takes longer to compute. This modules implemented prepopulating of |
4 | //! various caches, it's not really advanced at the moment. | 4 | //! various caches, it's not really advanced at the moment. |
5 | 5 | ||
6 | use base_db::SourceDatabase; | ||
7 | use hir::db::DefDatabase; | 6 | use hir::db::DefDatabase; |
7 | use ide_db::base_db::SourceDatabase; | ||
8 | 8 | ||
9 | use crate::RootDatabase; | 9 | use crate::RootDatabase; |
10 | 10 | ||
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index 67ec257a8..a517081d5 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs | |||
@@ -191,8 +191,8 @@ fn get_struct_def_name_for_struct_literal_search( | |||
191 | 191 | ||
192 | #[cfg(test)] | 192 | #[cfg(test)] |
193 | mod tests { | 193 | mod tests { |
194 | use base_db::FileId; | ||
195 | use expect_test::{expect, Expect}; | 194 | use expect_test::{expect, Expect}; |
195 | use ide_db::base_db::FileId; | ||
196 | use stdx::format_to; | 196 | use stdx::format_to; |
197 | 197 | ||
198 | use crate::{fixture, SearchScope}; | 198 | use crate::{fixture, SearchScope}; |
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs index 35aafc49d..26ac2371a 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use base_db::SourceDatabaseExt; | ||
4 | use hir::{Module, ModuleDef, ModuleSource, Semantics}; | 3 | use hir::{Module, ModuleDef, ModuleSource, Semantics}; |
4 | use ide_db::base_db::SourceDatabaseExt; | ||
5 | use ide_db::{ | 5 | use ide_db::{ |
6 | defs::{Definition, NameClass, NameRefClass}, | 6 | defs::{Definition, NameClass, NameRefClass}, |
7 | RootDatabase, | 7 | RootDatabase, |
diff --git a/crates/ide/src/status.rs b/crates/ide/src/status.rs index 0af84daa0..8e91c99d7 100644 --- a/crates/ide/src/status.rs +++ b/crates/ide/src/status.rs | |||
@@ -1,10 +1,10 @@ | |||
1 | use std::{fmt, iter::FromIterator, sync::Arc}; | 1 | use std::{fmt, iter::FromIterator, sync::Arc}; |
2 | 2 | ||
3 | use base_db::{ | 3 | use hir::MacroFile; |
4 | use ide_db::base_db::{ | ||
4 | salsa::debug::{DebugQueryTable, TableEntry}, | 5 | salsa::debug::{DebugQueryTable, TableEntry}, |
5 | CrateId, FileId, FileTextQuery, SourceDatabase, SourceRootId, | 6 | CrateId, FileId, FileTextQuery, SourceDatabase, SourceRootId, |
6 | }; | 7 | }; |
7 | use hir::MacroFile; | ||
8 | use ide_db::{ | 8 | use ide_db::{ |
9 | symbol_index::{LibrarySymbolsQuery, SymbolIndex}, | 9 | symbol_index::{LibrarySymbolsQuery, SymbolIndex}, |
10 | RootDatabase, | 10 | RootDatabase, |
@@ -16,7 +16,7 @@ use stdx::format_to; | |||
16 | use syntax::{ast, Parse, SyntaxNode}; | 16 | use syntax::{ast, Parse, SyntaxNode}; |
17 | 17 | ||
18 | fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { | 18 | fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { |
19 | base_db::ParseQuery.in_db(db).entries::<SyntaxTreeStats>() | 19 | ide_db::base_db::ParseQuery.in_db(db).entries::<SyntaxTreeStats>() |
20 | } | 20 | } |
21 | fn macro_syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { | 21 | fn macro_syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { |
22 | hir::db::ParseMacroQuery.in_db(db).entries::<SyntaxTreeStats>() | 22 | hir::db::ParseMacroQuery.in_db(db).entries::<SyntaxTreeStats>() |
diff --git a/crates/ide/src/syntax_highlighting/html.rs b/crates/ide/src/syntax_highlighting/html.rs index 57e2d2923..abcc5cccc 100644 --- a/crates/ide/src/syntax_highlighting/html.rs +++ b/crates/ide/src/syntax_highlighting/html.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! Renders a bit of code as HTML. | 1 | //! Renders a bit of code as HTML. |
2 | 2 | ||
3 | use base_db::SourceDatabase; | 3 | use ide_db::base_db::SourceDatabase; |
4 | use oorandom::Rand32; | 4 | use oorandom::Rand32; |
5 | use stdx::format_to; | 5 | use stdx::format_to; |
6 | use syntax::{AstNode, TextRange, TextSize}; | 6 | use syntax::{AstNode, TextRange, TextSize}; |
diff --git a/crates/ide/src/syntax_tree.rs b/crates/ide/src/syntax_tree.rs index 0eed2dbd7..7941610d6 100644 --- a/crates/ide/src/syntax_tree.rs +++ b/crates/ide/src/syntax_tree.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use base_db::{FileId, SourceDatabase}; | 1 | use ide_db::base_db::{FileId, SourceDatabase}; |
2 | use ide_db::RootDatabase; | 2 | use ide_db::RootDatabase; |
3 | use syntax::{ | 3 | use syntax::{ |
4 | algo, AstNode, NodeOrToken, SourceFile, | 4 | algo, AstNode, NodeOrToken, SourceFile, |
diff --git a/crates/ide/src/typing.rs b/crates/ide/src/typing.rs index 94b91f049..43458a3a2 100644 --- a/crates/ide/src/typing.rs +++ b/crates/ide/src/typing.rs | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | mod on_enter; | 16 | mod on_enter; |
17 | 17 | ||
18 | use base_db::{FilePosition, SourceDatabase}; | 18 | use ide_db::base_db::{FilePosition, SourceDatabase}; |
19 | use ide_db::{source_change::SourceFileEdit, RootDatabase}; | 19 | use ide_db::{source_change::SourceFileEdit, RootDatabase}; |
20 | use syntax::{ | 20 | use syntax::{ |
21 | algo::find_node_at_offset, | 21 | algo::find_node_at_offset, |
diff --git a/crates/ide/src/typing/on_enter.rs b/crates/ide/src/typing/on_enter.rs index 98adef1d6..f4ea30352 100644 --- a/crates/ide/src/typing/on_enter.rs +++ b/crates/ide/src/typing/on_enter.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Handles the `Enter` key press. At the momently, this only continues | 1 | //! Handles the `Enter` key press. At the momently, this only continues |
2 | //! comments, but should handle indent some time in the future as well. | 2 | //! comments, but should handle indent some time in the future as well. |
3 | 3 | ||
4 | use base_db::{FilePosition, SourceDatabase}; | 4 | use ide_db::base_db::{FilePosition, SourceDatabase}; |
5 | use ide_db::RootDatabase; | 5 | use ide_db::RootDatabase; |
6 | use syntax::{ | 6 | use syntax::{ |
7 | ast::{self, AstToken}, | 7 | ast::{self, AstToken}, |
diff --git a/crates/ide_db/src/lib.rs b/crates/ide_db/src/lib.rs index 303f7c964..38ebdbf79 100644 --- a/crates/ide_db/src/lib.rs +++ b/crates/ide_db/src/lib.rs | |||
@@ -26,6 +26,9 @@ use rustc_hash::FxHashSet; | |||
26 | 26 | ||
27 | use crate::{line_index::LineIndex, symbol_index::SymbolsDatabase}; | 27 | use crate::{line_index::LineIndex, symbol_index::SymbolsDatabase}; |
28 | 28 | ||
29 | /// `base_db` is normally also needed in places where `ide_db` is used, so this re-export is for convenience. | ||
30 | pub use base_db; | ||
31 | |||
29 | #[salsa::database( | 32 | #[salsa::database( |
30 | base_db::SourceDatabaseStorage, | 33 | base_db::SourceDatabaseStorage, |
31 | base_db::SourceDatabaseExtStorage, | 34 | base_db::SourceDatabaseExtStorage, |
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 66cf06e1a..f8f97b1d3 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml | |||
@@ -46,7 +46,6 @@ cfg = { path = "../cfg", version = "0.0.0" } | |||
46 | toolchain = { path = "../toolchain", version = "0.0.0" } | 46 | toolchain = { path = "../toolchain", version = "0.0.0" } |
47 | 47 | ||
48 | # This should only be used in CLI | 48 | # This should only be used in CLI |
49 | base_db = { path = "../base_db", version = "0.0.0" } | ||
50 | ide_db = { path = "../ide_db", version = "0.0.0" } | 49 | ide_db = { path = "../ide_db", version = "0.0.0" } |
51 | ssr = { path = "../ssr", version = "0.0.0" } | 50 | ssr = { path = "../ssr", version = "0.0.0" } |
52 | hir = { path = "../hir", version = "0.0.0" } | 51 | hir = { path = "../hir", version = "0.0.0" } |
diff --git a/crates/rust-analyzer/src/cli/analysis_bench.rs b/crates/rust-analyzer/src/cli/analysis_bench.rs index d1c095ba5..8e33986d5 100644 --- a/crates/rust-analyzer/src/cli/analysis_bench.rs +++ b/crates/rust-analyzer/src/cli/analysis_bench.rs | |||
@@ -3,13 +3,13 @@ | |||
3 | use std::{env, path::PathBuf, str::FromStr, sync::Arc, time::Instant}; | 3 | use std::{env, path::PathBuf, str::FromStr, sync::Arc, time::Instant}; |
4 | 4 | ||
5 | use anyhow::{bail, format_err, Result}; | 5 | use anyhow::{bail, format_err, Result}; |
6 | use base_db::{ | ||
7 | salsa::{Database, Durability}, | ||
8 | FileId, | ||
9 | }; | ||
10 | use ide::{ | 6 | use ide::{ |
11 | Analysis, AnalysisHost, Change, CompletionConfig, DiagnosticsConfig, FilePosition, LineCol, | 7 | Analysis, AnalysisHost, Change, CompletionConfig, DiagnosticsConfig, FilePosition, LineCol, |
12 | }; | 8 | }; |
9 | use ide_db::base_db::{ | ||
10 | salsa::{Database, Durability}, | ||
11 | FileId, | ||
12 | }; | ||
13 | use vfs::AbsPathBuf; | 13 | use vfs::AbsPathBuf; |
14 | 14 | ||
15 | use crate::{ | 15 | use crate::{ |
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs index fb2b2b000..98ef0cd68 100644 --- a/crates/rust-analyzer/src/cli/analysis_stats.rs +++ b/crates/rust-analyzer/src/cli/analysis_stats.rs | |||
@@ -6,16 +6,16 @@ use std::{ | |||
6 | time::{SystemTime, UNIX_EPOCH}, | 6 | time::{SystemTime, UNIX_EPOCH}, |
7 | }; | 7 | }; |
8 | 8 | ||
9 | use base_db::{ | ||
10 | salsa::{self, ParallelDatabase}, | ||
11 | SourceDatabaseExt, | ||
12 | }; | ||
13 | use hir::{ | 9 | use hir::{ |
14 | db::{AstDatabase, DefDatabase, HirDatabase}, | 10 | db::{AstDatabase, DefDatabase, HirDatabase}, |
15 | original_range, AssocItem, Crate, HasSource, HirDisplay, ModuleDef, | 11 | original_range, AssocItem, Crate, HasSource, HirDisplay, ModuleDef, |
16 | }; | 12 | }; |
17 | use hir_def::FunctionId; | 13 | use hir_def::FunctionId; |
18 | use hir_ty::{Ty, TypeWalk}; | 14 | use hir_ty::{Ty, TypeWalk}; |
15 | use ide_db::base_db::{ | ||
16 | salsa::{self, ParallelDatabase}, | ||
17 | SourceDatabaseExt, | ||
18 | }; | ||
19 | use itertools::Itertools; | 19 | use itertools::Itertools; |
20 | use oorandom::Rand32; | 20 | use oorandom::Rand32; |
21 | use rayon::prelude::*; | 21 | use rayon::prelude::*; |
diff --git a/crates/rust-analyzer/src/cli/diagnostics.rs b/crates/rust-analyzer/src/cli/diagnostics.rs index a89993a2b..368f627ac 100644 --- a/crates/rust-analyzer/src/cli/diagnostics.rs +++ b/crates/rust-analyzer/src/cli/diagnostics.rs | |||
@@ -6,9 +6,9 @@ use std::path::Path; | |||
6 | use anyhow::anyhow; | 6 | use anyhow::anyhow; |
7 | use rustc_hash::FxHashSet; | 7 | use rustc_hash::FxHashSet; |
8 | 8 | ||
9 | use base_db::SourceDatabaseExt; | ||
10 | use hir::Crate; | 9 | use hir::Crate; |
11 | use ide::{DiagnosticsConfig, Severity}; | 10 | use ide::{DiagnosticsConfig, Severity}; |
11 | use ide_db::base_db::SourceDatabaseExt; | ||
12 | 12 | ||
13 | use crate::cli::{load_cargo::load_cargo, Result}; | 13 | use crate::cli::{load_cargo::load_cargo, Result}; |
14 | 14 | ||
diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs index 7ae1c9055..ab1e2ab92 100644 --- a/crates/rust-analyzer/src/cli/load_cargo.rs +++ b/crates/rust-analyzer/src/cli/load_cargo.rs | |||
@@ -3,9 +3,9 @@ | |||
3 | use std::{path::Path, sync::Arc}; | 3 | use std::{path::Path, sync::Arc}; |
4 | 4 | ||
5 | use anyhow::Result; | 5 | use anyhow::Result; |
6 | use base_db::CrateGraph; | ||
7 | use crossbeam_channel::{unbounded, Receiver}; | 6 | use crossbeam_channel::{unbounded, Receiver}; |
8 | use ide::{AnalysisHost, Change}; | 7 | use ide::{AnalysisHost, Change}; |
8 | use ide_db::base_db::CrateGraph; | ||
9 | use project_model::{CargoConfig, ProcMacroClient, ProjectManifest, ProjectWorkspace}; | 9 | use project_model::{CargoConfig, ProcMacroClient, ProjectManifest, ProjectWorkspace}; |
10 | use vfs::{loader::Handle, AbsPath, AbsPathBuf}; | 10 | use vfs::{loader::Handle, AbsPath, AbsPathBuf}; |
11 | 11 | ||
diff --git a/crates/rust-analyzer/src/cli/ssr.rs b/crates/rust-analyzer/src/cli/ssr.rs index c11e10943..a06631dac 100644 --- a/crates/rust-analyzer/src/cli/ssr.rs +++ b/crates/rust-analyzer/src/cli/ssr.rs | |||
@@ -4,7 +4,7 @@ use crate::cli::{load_cargo::load_cargo, Result}; | |||
4 | use ssr::{MatchFinder, SsrPattern, SsrRule}; | 4 | use ssr::{MatchFinder, SsrPattern, SsrRule}; |
5 | 5 | ||
6 | pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> { | 6 | pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> { |
7 | use base_db::SourceDatabaseExt; | 7 | use ide_db::base_db::SourceDatabaseExt; |
8 | let (host, vfs) = load_cargo(&std::env::current_dir()?, true, true)?; | 8 | let (host, vfs) = load_cargo(&std::env::current_dir()?, true, true)?; |
9 | let db = host.raw_database(); | 9 | let db = host.raw_database(); |
10 | let mut match_finder = MatchFinder::at_first_file(db)?; | 10 | let mut match_finder = MatchFinder::at_first_file(db)?; |
@@ -26,7 +26,7 @@ pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> { | |||
26 | /// `debug_snippet`. This is intended for debugging and probably isn't in it's current form useful | 26 | /// `debug_snippet`. This is intended for debugging and probably isn't in it's current form useful |
27 | /// for much else. | 27 | /// for much else. |
28 | pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<String>) -> Result<()> { | 28 | pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<String>) -> Result<()> { |
29 | use base_db::SourceDatabaseExt; | 29 | use ide_db::base_db::SourceDatabaseExt; |
30 | use ide_db::symbol_index::SymbolsDatabase; | 30 | use ide_db::symbol_index::SymbolsDatabase; |
31 | let (host, _vfs) = load_cargo(&std::env::current_dir()?, true, true)?; | 31 | let (host, _vfs) = load_cargo(&std::env::current_dir()?, true, true)?; |
32 | let db = host.raw_database(); | 32 | let db = host.raw_database(); |
diff --git a/crates/rust-analyzer/src/from_proto.rs b/crates/rust-analyzer/src/from_proto.rs index 5b9f52993..aa6b808d6 100644 --- a/crates/rust-analyzer/src/from_proto.rs +++ b/crates/rust-analyzer/src/from_proto.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | //! Conversion lsp_types types to rust-analyzer specific ones. | 1 | //! Conversion lsp_types types to rust-analyzer specific ones. |
2 | use std::convert::TryFrom; | 2 | use std::convert::TryFrom; |
3 | 3 | ||
4 | use base_db::{FileId, FilePosition, FileRange}; | ||
5 | use ide::{AssistKind, LineCol, LineIndex}; | 4 | use ide::{AssistKind, LineCol, LineIndex}; |
5 | use ide_db::base_db::{FileId, FilePosition, FileRange}; | ||
6 | use syntax::{TextRange, TextSize}; | 6 | use syntax::{TextRange, TextSize}; |
7 | use vfs::AbsPathBuf; | 7 | use vfs::AbsPathBuf; |
8 | 8 | ||
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index dafab6a6a..673a2eebc 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs | |||
@@ -5,10 +5,10 @@ | |||
5 | 5 | ||
6 | use std::{sync::Arc, time::Instant}; | 6 | use std::{sync::Arc, time::Instant}; |
7 | 7 | ||
8 | use base_db::{CrateId, VfsPath}; | ||
9 | use crossbeam_channel::{unbounded, Receiver, Sender}; | 8 | use crossbeam_channel::{unbounded, Receiver, Sender}; |
10 | use flycheck::FlycheckHandle; | 9 | use flycheck::FlycheckHandle; |
11 | use ide::{Analysis, AnalysisHost, Change, FileId}; | 10 | use ide::{Analysis, AnalysisHost, Change, FileId}; |
11 | use ide_db::base_db::{CrateId, VfsPath}; | ||
12 | use lsp_types::{SemanticTokens, Url}; | 12 | use lsp_types::{SemanticTokens, Url}; |
13 | use parking_lot::{Mutex, RwLock}; | 13 | use parking_lot::{Mutex, RwLock}; |
14 | use project_model::{CargoWorkspace, ProcMacroClient, ProjectWorkspace, Target}; | 14 | use project_model::{CargoWorkspace, ProcMacroClient, ProjectWorkspace, Target}; |
diff --git a/crates/rust-analyzer/src/lsp_utils.rs b/crates/rust-analyzer/src/lsp_utils.rs index bd888f634..1d271a9d8 100644 --- a/crates/rust-analyzer/src/lsp_utils.rs +++ b/crates/rust-analyzer/src/lsp_utils.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | //! Utilities for LSP-related boilerplate code. | 1 | //! Utilities for LSP-related boilerplate code. |
2 | use std::{error::Error, ops::Range}; | 2 | use std::{error::Error, ops::Range}; |
3 | 3 | ||
4 | use base_db::Canceled; | ||
5 | use ide::LineIndex; | 4 | use ide::LineIndex; |
5 | use ide_db::base_db::Canceled; | ||
6 | use lsp_server::Notification; | 6 | use lsp_server::Notification; |
7 | 7 | ||
8 | use crate::{from_proto, global_state::GlobalState}; | 8 | use crate::{from_proto, global_state::GlobalState}; |
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index fb18f9014..ed5292733 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -5,10 +5,10 @@ use std::{ | |||
5 | time::{Duration, Instant}, | 5 | time::{Duration, Instant}, |
6 | }; | 6 | }; |
7 | 7 | ||
8 | use base_db::VfsPath; | ||
9 | use crossbeam_channel::{select, Receiver}; | 8 | use crossbeam_channel::{select, Receiver}; |
10 | use ide::PrimeCachesProgress; | 9 | use ide::PrimeCachesProgress; |
11 | use ide::{Canceled, FileId}; | 10 | use ide::{Canceled, FileId}; |
11 | use ide_db::base_db::VfsPath; | ||
12 | use lsp_server::{Connection, Notification, Request, Response}; | 12 | use lsp_server::{Connection, Notification, Request, Response}; |
13 | use lsp_types::notification::Notification as _; | 13 | use lsp_types::notification::Notification as _; |
14 | use project_model::ProjectWorkspace; | 14 | use project_model::ProjectWorkspace; |
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs index f7215f129..0eabd51bd 100644 --- a/crates/rust-analyzer/src/reload.rs +++ b/crates/rust-analyzer/src/reload.rs | |||
@@ -1,9 +1,9 @@ | |||
1 | //! Project loading & configuration updates | 1 | //! Project loading & configuration updates |
2 | use std::{mem, sync::Arc}; | 2 | use std::{mem, sync::Arc}; |
3 | 3 | ||
4 | use base_db::{CrateGraph, SourceRoot, VfsPath}; | ||
5 | use flycheck::{FlycheckConfig, FlycheckHandle}; | 4 | use flycheck::{FlycheckConfig, FlycheckHandle}; |
6 | use ide::Change; | 5 | use ide::Change; |
6 | use ide_db::base_db::{CrateGraph, SourceRoot, VfsPath}; | ||
7 | use project_model::{ProcMacroClient, ProjectWorkspace}; | 7 | use project_model::{ProcMacroClient, ProjectWorkspace}; |
8 | use vfs::{file_set::FileSetConfig, AbsPath, AbsPathBuf, ChangeKind}; | 8 | use vfs::{file_set::FileSetConfig, AbsPath, AbsPathBuf, ChangeKind}; |
9 | 9 | ||
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 0d34970bc..24a658fc6 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -4,13 +4,13 @@ use std::{ | |||
4 | sync::atomic::{AtomicU32, Ordering}, | 4 | sync::atomic::{AtomicU32, Ordering}, |
5 | }; | 5 | }; |
6 | 6 | ||
7 | use base_db::{FileId, FileRange}; | ||
8 | use ide::{ | 7 | use ide::{ |
9 | Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, Documentation, | 8 | Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, Documentation, |
10 | FileSystemEdit, Fold, FoldKind, Highlight, HighlightModifier, HighlightTag, HighlightedRange, | 9 | FileSystemEdit, Fold, FoldKind, Highlight, HighlightModifier, HighlightTag, HighlightedRange, |
11 | Indel, InlayHint, InlayKind, InsertTextFormat, LineIndex, Markup, NavigationTarget, | 10 | Indel, InlayHint, InlayKind, InsertTextFormat, LineIndex, Markup, NavigationTarget, |
12 | ReferenceAccess, ResolvedAssist, Runnable, Severity, SourceChange, SourceFileEdit, TextEdit, | 11 | ReferenceAccess, ResolvedAssist, Runnable, Severity, SourceChange, SourceFileEdit, TextEdit, |
13 | }; | 12 | }; |
13 | use ide_db::base_db::{FileId, FileRange}; | ||
14 | use itertools::Itertools; | 14 | use itertools::Itertools; |
15 | use syntax::{SyntaxKind, TextRange, TextSize}; | 15 | use syntax::{SyntaxKind, TextRange, TextSize}; |
16 | 16 | ||
@@ -809,7 +809,7 @@ mod tests { | |||
809 | let completions: Vec<(String, Option<String>)> = analysis | 809 | let completions: Vec<(String, Option<String>)> = analysis |
810 | .completions( | 810 | .completions( |
811 | &ide::CompletionConfig::default(), | 811 | &ide::CompletionConfig::default(), |
812 | base_db::FilePosition { file_id, offset }, | 812 | ide_db::base_db::FilePosition { file_id, offset }, |
813 | ) | 813 | ) |
814 | .unwrap() | 814 | .unwrap() |
815 | .unwrap() | 815 | .unwrap() |
diff --git a/crates/ssr/Cargo.toml b/crates/ssr/Cargo.toml index 408140014..98ed25fb6 100644 --- a/crates/ssr/Cargo.toml +++ b/crates/ssr/Cargo.toml | |||
@@ -16,7 +16,6 @@ itertools = "0.9.0" | |||
16 | 16 | ||
17 | text_edit = { path = "../text_edit", version = "0.0.0" } | 17 | text_edit = { path = "../text_edit", version = "0.0.0" } |
18 | syntax = { path = "../syntax", version = "0.0.0" } | 18 | syntax = { path = "../syntax", version = "0.0.0" } |
19 | base_db = { path = "../base_db", version = "0.0.0" } | ||
20 | ide_db = { path = "../ide_db", version = "0.0.0" } | 19 | ide_db = { path = "../ide_db", version = "0.0.0" } |
21 | hir = { path = "../hir", version = "0.0.0" } | 20 | hir = { path = "../hir", version = "0.0.0" } |
22 | test_utils = { path = "../test_utils", version = "0.0.0" } | 21 | test_utils = { path = "../test_utils", version = "0.0.0" } |
diff --git a/crates/ssr/src/lib.rs b/crates/ssr/src/lib.rs index ba669fd56..747ce495d 100644 --- a/crates/ssr/src/lib.rs +++ b/crates/ssr/src/lib.rs | |||
@@ -73,8 +73,8 @@ use crate::errors::bail; | |||
73 | pub use crate::errors::SsrError; | 73 | pub use crate::errors::SsrError; |
74 | pub use crate::matching::Match; | 74 | pub use crate::matching::Match; |
75 | use crate::matching::MatchFailureReason; | 75 | use crate::matching::MatchFailureReason; |
76 | use base_db::{FileId, FilePosition, FileRange}; | ||
77 | use hir::Semantics; | 76 | use hir::Semantics; |
77 | use ide_db::base_db::{FileId, FilePosition, FileRange}; | ||
78 | use ide_db::source_change::SourceFileEdit; | 78 | use ide_db::source_change::SourceFileEdit; |
79 | use resolving::ResolvedRule; | 79 | use resolving::ResolvedRule; |
80 | use rustc_hash::FxHashMap; | 80 | use rustc_hash::FxHashMap; |
@@ -126,7 +126,7 @@ impl<'db> MatchFinder<'db> { | |||
126 | 126 | ||
127 | /// Constructs an instance using the start of the first file in `db` as the lookup context. | 127 | /// Constructs an instance using the start of the first file in `db` as the lookup context. |
128 | pub fn at_first_file(db: &'db ide_db::RootDatabase) -> Result<MatchFinder<'db>, SsrError> { | 128 | pub fn at_first_file(db: &'db ide_db::RootDatabase) -> Result<MatchFinder<'db>, SsrError> { |
129 | use base_db::SourceDatabaseExt; | 129 | use ide_db::base_db::SourceDatabaseExt; |
130 | use ide_db::symbol_index::SymbolsDatabase; | 130 | use ide_db::symbol_index::SymbolsDatabase; |
131 | if let Some(first_file_id) = db | 131 | if let Some(first_file_id) = db |
132 | .local_roots() | 132 | .local_roots() |
@@ -160,7 +160,7 @@ impl<'db> MatchFinder<'db> { | |||
160 | 160 | ||
161 | /// Finds matches for all added rules and returns edits for all found matches. | 161 | /// Finds matches for all added rules and returns edits for all found matches. |
162 | pub fn edits(&self) -> Vec<SourceFileEdit> { | 162 | pub fn edits(&self) -> Vec<SourceFileEdit> { |
163 | use base_db::SourceDatabaseExt; | 163 | use ide_db::base_db::SourceDatabaseExt; |
164 | let mut matches_by_file = FxHashMap::default(); | 164 | let mut matches_by_file = FxHashMap::default(); |
165 | for m in self.matches().matches { | 165 | for m in self.matches().matches { |
166 | matches_by_file | 166 | matches_by_file |
@@ -205,7 +205,7 @@ impl<'db> MatchFinder<'db> { | |||
205 | /// them, while recording reasons why they don't match. This API is useful for command | 205 | /// them, while recording reasons why they don't match. This API is useful for command |
206 | /// line-based debugging where providing a range is difficult. | 206 | /// line-based debugging where providing a range is difficult. |
207 | pub fn debug_where_text_equal(&self, file_id: FileId, snippet: &str) -> Vec<MatchDebugInfo> { | 207 | pub fn debug_where_text_equal(&self, file_id: FileId, snippet: &str) -> Vec<MatchDebugInfo> { |
208 | use base_db::SourceDatabaseExt; | 208 | use ide_db::base_db::SourceDatabaseExt; |
209 | let file = self.sema.parse(file_id); | 209 | let file = self.sema.parse(file_id); |
210 | let mut res = Vec::new(); | 210 | let mut res = Vec::new(); |
211 | let file_text = self.sema.db.file_text(file_id); | 211 | let file_text = self.sema.db.file_text(file_id); |
diff --git a/crates/ssr/src/matching.rs b/crates/ssr/src/matching.rs index 948862a77..99b187311 100644 --- a/crates/ssr/src/matching.rs +++ b/crates/ssr/src/matching.rs | |||
@@ -6,8 +6,8 @@ use crate::{ | |||
6 | resolving::{ResolvedPattern, ResolvedRule, UfcsCallInfo}, | 6 | resolving::{ResolvedPattern, ResolvedRule, UfcsCallInfo}, |
7 | SsrMatches, | 7 | SsrMatches, |
8 | }; | 8 | }; |
9 | use base_db::FileRange; | ||
10 | use hir::Semantics; | 9 | use hir::Semantics; |
10 | use ide_db::base_db::FileRange; | ||
11 | use rustc_hash::FxHashMap; | 11 | use rustc_hash::FxHashMap; |
12 | use std::{cell::Cell, iter::Peekable}; | 12 | use std::{cell::Cell, iter::Peekable}; |
13 | use syntax::ast::{AstNode, AstToken}; | 13 | use syntax::ast::{AstNode, AstToken}; |
diff --git a/crates/ssr/src/resolving.rs b/crates/ssr/src/resolving.rs index 347cc4aad..f5ceb5729 100644 --- a/crates/ssr/src/resolving.rs +++ b/crates/ssr/src/resolving.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use crate::errors::error; | 3 | use crate::errors::error; |
4 | use crate::{parsing, SsrError}; | 4 | use crate::{parsing, SsrError}; |
5 | use base_db::FilePosition; | 5 | use ide_db::base_db::FilePosition; |
6 | use parsing::Placeholder; | 6 | use parsing::Placeholder; |
7 | use rustc_hash::FxHashMap; | 7 | use rustc_hash::FxHashMap; |
8 | use syntax::{ast, SmolStr, SyntaxKind, SyntaxNode, SyntaxToken}; | 8 | use syntax::{ast, SmolStr, SyntaxKind, SyntaxNode, SyntaxToken}; |
diff --git a/crates/ssr/src/search.rs b/crates/ssr/src/search.rs index a595fd269..44b5db029 100644 --- a/crates/ssr/src/search.rs +++ b/crates/ssr/src/search.rs | |||
@@ -5,7 +5,7 @@ use crate::{ | |||
5 | resolving::{ResolvedPath, ResolvedPattern, ResolvedRule}, | 5 | resolving::{ResolvedPath, ResolvedPattern, ResolvedRule}, |
6 | Match, MatchFinder, | 6 | Match, MatchFinder, |
7 | }; | 7 | }; |
8 | use base_db::{FileId, FileRange}; | 8 | use ide_db::base_db::{FileId, FileRange}; |
9 | use ide_db::{ | 9 | use ide_db::{ |
10 | defs::Definition, | 10 | defs::Definition, |
11 | search::{Reference, SearchScope}, | 11 | search::{Reference, SearchScope}, |
@@ -145,7 +145,7 @@ impl<'db> MatchFinder<'db> { | |||
145 | fn search_files_do(&self, mut callback: impl FnMut(FileId)) { | 145 | fn search_files_do(&self, mut callback: impl FnMut(FileId)) { |
146 | if self.restrict_ranges.is_empty() { | 146 | if self.restrict_ranges.is_empty() { |
147 | // Unrestricted search. | 147 | // Unrestricted search. |
148 | use base_db::SourceDatabaseExt; | 148 | use ide_db::base_db::SourceDatabaseExt; |
149 | use ide_db::symbol_index::SymbolsDatabase; | 149 | use ide_db::symbol_index::SymbolsDatabase; |
150 | for &root in self.sema.db.local_roots().iter() { | 150 | for &root in self.sema.db.local_roots().iter() { |
151 | let sr = self.sema.db.source_root(root); | 151 | let sr = self.sema.db.source_root(root); |
diff --git a/crates/ssr/src/tests.rs b/crates/ssr/src/tests.rs index 20231a9bc..63131f6ca 100644 --- a/crates/ssr/src/tests.rs +++ b/crates/ssr/src/tests.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use crate::{MatchFinder, SsrRule}; | 1 | use crate::{MatchFinder, SsrRule}; |
2 | use base_db::{salsa::Durability, FileId, FilePosition, FileRange, SourceDatabaseExt}; | ||
3 | use expect_test::{expect, Expect}; | 2 | use expect_test::{expect, Expect}; |
3 | use ide_db::base_db::{salsa::Durability, FileId, FilePosition, FileRange, SourceDatabaseExt}; | ||
4 | use rustc_hash::FxHashSet; | 4 | use rustc_hash::FxHashSet; |
5 | use std::sync::Arc; | 5 | use std::sync::Arc; |
6 | use test_utils::{mark, RangeOrOffset}; | 6 | use test_utils::{mark, RangeOrOffset}; |
@@ -62,7 +62,7 @@ fn parser_undefined_placeholder_in_replacement() { | |||
62 | /// `code` may optionally contain a cursor marker `<|>`. If it doesn't, then the position will be | 62 | /// `code` may optionally contain a cursor marker `<|>`. If it doesn't, then the position will be |
63 | /// the start of the file. If there's a second cursor marker, then we'll return a single range. | 63 | /// the start of the file. If there's a second cursor marker, then we'll return a single range. |
64 | pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Vec<FileRange>) { | 64 | pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Vec<FileRange>) { |
65 | use base_db::fixture::WithFixture; | 65 | use ide_db::base_db::fixture::WithFixture; |
66 | use ide_db::symbol_index::SymbolsDatabase; | 66 | use ide_db::symbol_index::SymbolsDatabase; |
67 | let (mut db, file_id, range_or_offset) = if code.contains(test_utils::CURSOR_MARKER) { | 67 | let (mut db, file_id, range_or_offset) = if code.contains(test_utils::CURSOR_MARKER) { |
68 | ide_db::RootDatabase::with_range_or_offset(code) | 68 | ide_db::RootDatabase::with_range_or_offset(code) |
@@ -83,7 +83,7 @@ pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Ve | |||
83 | } | 83 | } |
84 | } | 84 | } |
85 | let mut local_roots = FxHashSet::default(); | 85 | let mut local_roots = FxHashSet::default(); |
86 | local_roots.insert(base_db::fixture::WORKSPACE); | 86 | local_roots.insert(ide_db::base_db::fixture::WORKSPACE); |
87 | db.set_local_roots_with_durability(Arc::new(local_roots), Durability::HIGH); | 87 | db.set_local_roots_with_durability(Arc::new(local_roots), Durability::HIGH); |
88 | (db, position, selections) | 88 | (db, position, selections) |
89 | } | 89 | } |