diff options
59 files changed, 93 insertions, 99 deletions
diff --git a/Cargo.lock b/Cargo.lock index ae71ea9fd..8704e4386 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -563,6 +563,25 @@ dependencies = [ | |||
563 | ] | 563 | ] |
564 | 564 | ||
565 | [[package]] | 565 | [[package]] |
566 | name = "ide_db" | ||
567 | version = "0.0.0" | ||
568 | dependencies = [ | ||
569 | "base_db", | ||
570 | "either", | ||
571 | "fst", | ||
572 | "hir", | ||
573 | "log", | ||
574 | "once_cell", | ||
575 | "profile", | ||
576 | "rayon", | ||
577 | "rustc-hash", | ||
578 | "stdx", | ||
579 | "syntax", | ||
580 | "test_utils", | ||
581 | "text_edit", | ||
582 | ] | ||
583 | |||
584 | [[package]] | ||
566 | name = "idna" | 585 | name = "idna" |
567 | version = "0.2.0" | 586 | version = "0.2.0" |
568 | source = "registry+https://github.com/rust-lang/crates.io-index" | 587 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1090,9 +1109,9 @@ dependencies = [ | |||
1090 | "base_db", | 1109 | "base_db", |
1091 | "either", | 1110 | "either", |
1092 | "hir", | 1111 | "hir", |
1112 | "ide_db", | ||
1093 | "itertools", | 1113 | "itertools", |
1094 | "profile", | 1114 | "profile", |
1095 | "ra_ide_db", | ||
1096 | "rustc-hash", | 1115 | "rustc-hash", |
1097 | "stdx", | 1116 | "stdx", |
1098 | "syntax", | 1117 | "syntax", |
@@ -1109,13 +1128,13 @@ dependencies = [ | |||
1109 | "either", | 1128 | "either", |
1110 | "expect", | 1129 | "expect", |
1111 | "hir", | 1130 | "hir", |
1131 | "ide_db", | ||
1112 | "indexmap", | 1132 | "indexmap", |
1113 | "itertools", | 1133 | "itertools", |
1114 | "log", | 1134 | "log", |
1115 | "oorandom", | 1135 | "oorandom", |
1116 | "profile", | 1136 | "profile", |
1117 | "ra_assists", | 1137 | "ra_assists", |
1118 | "ra_ide_db", | ||
1119 | "ra_ssr", | 1138 | "ra_ssr", |
1120 | "rustc-hash", | 1139 | "rustc-hash", |
1121 | "stdx", | 1140 | "stdx", |
@@ -1125,32 +1144,13 @@ dependencies = [ | |||
1125 | ] | 1144 | ] |
1126 | 1145 | ||
1127 | [[package]] | 1146 | [[package]] |
1128 | name = "ra_ide_db" | ||
1129 | version = "0.1.0" | ||
1130 | dependencies = [ | ||
1131 | "base_db", | ||
1132 | "either", | ||
1133 | "fst", | ||
1134 | "hir", | ||
1135 | "log", | ||
1136 | "once_cell", | ||
1137 | "profile", | ||
1138 | "rayon", | ||
1139 | "rustc-hash", | ||
1140 | "stdx", | ||
1141 | "syntax", | ||
1142 | "test_utils", | ||
1143 | "text_edit", | ||
1144 | ] | ||
1145 | |||
1146 | [[package]] | ||
1147 | name = "ra_ssr" | 1147 | name = "ra_ssr" |
1148 | version = "0.1.0" | 1148 | version = "0.1.0" |
1149 | dependencies = [ | 1149 | dependencies = [ |
1150 | "base_db", | 1150 | "base_db", |
1151 | "expect", | 1151 | "expect", |
1152 | "hir", | 1152 | "hir", |
1153 | "ra_ide_db", | 1153 | "ide_db", |
1154 | "rustc-hash", | 1154 | "rustc-hash", |
1155 | "syntax", | 1155 | "syntax", |
1156 | "test_utils", | 1156 | "test_utils", |
@@ -1239,6 +1239,7 @@ dependencies = [ | |||
1239 | "hir", | 1239 | "hir", |
1240 | "hir_def", | 1240 | "hir_def", |
1241 | "hir_ty", | 1241 | "hir_ty", |
1242 | "ide_db", | ||
1242 | "itertools", | 1243 | "itertools", |
1243 | "jod-thread", | 1244 | "jod-thread", |
1244 | "log", | 1245 | "log", |
@@ -1253,7 +1254,6 @@ dependencies = [ | |||
1253 | "profile", | 1254 | "profile", |
1254 | "project_model", | 1255 | "project_model", |
1255 | "ra_ide", | 1256 | "ra_ide", |
1256 | "ra_ide_db", | ||
1257 | "ra_ssr", | 1257 | "ra_ssr", |
1258 | "rayon", | 1258 | "rayon", |
1259 | "rustc-hash", | 1259 | "rustc-hash", |
diff --git a/crates/ra_ide_db/Cargo.toml b/crates/ide_db/Cargo.toml index eda257a3a..885212162 100644 --- a/crates/ra_ide_db/Cargo.toml +++ b/crates/ide_db/Cargo.toml | |||
@@ -1,9 +1,9 @@ | |||
1 | [package] | 1 | [package] |
2 | edition = "2018" | 2 | name = "ide_db" |
3 | name = "ra_ide_db" | 3 | version = "0.0.0" |
4 | version = "0.1.0" | ||
5 | authors = ["rust-analyzer developers"] | ||
6 | license = "MIT OR Apache-2.0" | 4 | license = "MIT OR Apache-2.0" |
5 | authors = ["rust-analyzer developers"] | ||
6 | edition = "2018" | ||
7 | 7 | ||
8 | [lib] | 8 | [lib] |
9 | doctest = false | 9 | doctest = false |
@@ -20,13 +20,11 @@ once_cell = "1.3.1" | |||
20 | either = "1.5.3" | 20 | either = "1.5.3" |
21 | 21 | ||
22 | stdx = { path = "../stdx" } | 22 | stdx = { path = "../stdx" } |
23 | |||
24 | syntax = { path = "../syntax" } | 23 | syntax = { path = "../syntax" } |
25 | text_edit = { path = "../text_edit" } | 24 | text_edit = { path = "../text_edit" } |
26 | base_db = { path = "../base_db" } | 25 | base_db = { path = "../base_db" } |
27 | profile = { path = "../profile" } | 26 | profile = { path = "../profile" } |
28 | test_utils = { path = "../test_utils" } | 27 | test_utils = { path = "../test_utils" } |
29 | |||
30 | # ra_ide should depend only on the top-level `hir` package. if you need | 28 | # ra_ide should depend only on the top-level `hir` package. if you need |
31 | # something from some `hir_xxx` subpackage, reexport the API via `hir`. | 29 | # something from some `hir_xxx` subpackage, reexport the API via `hir`. |
32 | hir = { path = "../hir" } | 30 | hir = { path = "../hir" } |
diff --git a/crates/ra_ide_db/src/change.rs b/crates/ide_db/src/change.rs index 8b4fd7ab8..8b4fd7ab8 100644 --- a/crates/ra_ide_db/src/change.rs +++ b/crates/ide_db/src/change.rs | |||
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ide_db/src/defs.rs index 7b5d6ac49..7b5d6ac49 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ide_db/src/defs.rs | |||
diff --git a/crates/ra_ide_db/src/imports_locator.rs b/crates/ide_db/src/imports_locator.rs index 1d0c20291..1d0c20291 100644 --- a/crates/ra_ide_db/src/imports_locator.rs +++ b/crates/ide_db/src/imports_locator.rs | |||
diff --git a/crates/ra_ide_db/src/lib.rs b/crates/ide_db/src/lib.rs index fd474cd0f..fd474cd0f 100644 --- a/crates/ra_ide_db/src/lib.rs +++ b/crates/ide_db/src/lib.rs | |||
diff --git a/crates/ra_ide_db/src/line_index.rs b/crates/ide_db/src/line_index.rs index a381f7fb8..a381f7fb8 100644 --- a/crates/ra_ide_db/src/line_index.rs +++ b/crates/ide_db/src/line_index.rs | |||
diff --git a/crates/ra_ide_db/src/search.rs b/crates/ide_db/src/search.rs index b9360bf12..b9360bf12 100644 --- a/crates/ra_ide_db/src/search.rs +++ b/crates/ide_db/src/search.rs | |||
diff --git a/crates/ra_ide_db/src/source_change.rs b/crates/ide_db/src/source_change.rs index f1590ec66..f1590ec66 100644 --- a/crates/ra_ide_db/src/source_change.rs +++ b/crates/ide_db/src/source_change.rs | |||
diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ide_db/src/symbol_index.rs index 654df898e..654df898e 100644 --- a/crates/ra_ide_db/src/symbol_index.rs +++ b/crates/ide_db/src/symbol_index.rs | |||
diff --git a/crates/ra_ide_db/src/wasm_shims.rs b/crates/ide_db/src/wasm_shims.rs index 7af9f9d9b..7af9f9d9b 100644 --- a/crates/ra_ide_db/src/wasm_shims.rs +++ b/crates/ide_db/src/wasm_shims.rs | |||
diff --git a/crates/ra_assists/Cargo.toml b/crates/ra_assists/Cargo.toml index cacc063da..19e7591f7 100644 --- a/crates/ra_assists/Cargo.toml +++ b/crates/ra_assists/Cargo.toml | |||
@@ -19,6 +19,6 @@ syntax = { path = "../syntax" } | |||
19 | text_edit = { path = "../text_edit" } | 19 | text_edit = { path = "../text_edit" } |
20 | profile = { path = "../profile" } | 20 | profile = { path = "../profile" } |
21 | base_db = { path = "../base_db" } | 21 | base_db = { path = "../base_db" } |
22 | ra_ide_db = { path = "../ra_ide_db" } | 22 | ide_db = { path = "../ide_db" } |
23 | hir = { path = "../hir" } | 23 | hir = { path = "../hir" } |
24 | test_utils = { path = "../test_utils" } | 24 | test_utils = { path = "../test_utils" } |
diff --git a/crates/ra_assists/src/assist_context.rs b/crates/ra_assists/src/assist_context.rs index 2fdce037f..79574b9ac 100644 --- a/crates/ra_assists/src/assist_context.rs +++ b/crates/ra_assists/src/assist_context.rs | |||
@@ -5,7 +5,7 @@ use std::mem; | |||
5 | use algo::find_covering_element; | 5 | use algo::find_covering_element; |
6 | use base_db::{FileId, FileRange}; | 6 | use base_db::{FileId, FileRange}; |
7 | use hir::Semantics; | 7 | use hir::Semantics; |
8 | use ra_ide_db::{ | 8 | use ide_db::{ |
9 | source_change::{SourceChange, SourceFileEdit}, | 9 | source_change::{SourceChange, SourceFileEdit}, |
10 | RootDatabase, | 10 | RootDatabase, |
11 | }; | 11 | }; |
diff --git a/crates/ra_assists/src/handlers/add_turbo_fish.rs b/crates/ra_assists/src/handlers/add_turbo_fish.rs index 8c7ffae3d..f4f997d8e 100644 --- a/crates/ra_assists/src/handlers/add_turbo_fish.rs +++ b/crates/ra_assists/src/handlers/add_turbo_fish.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ra_ide_db::defs::{classify_name_ref, Definition, NameRefClass}; | 1 | use ide_db::defs::{classify_name_ref, Definition, NameRefClass}; |
2 | use syntax::{ast, AstNode, SyntaxKind, T}; | 2 | use syntax::{ast, AstNode, SyntaxKind, T}; |
3 | use test_utils::mark; | 3 | use test_utils::mark; |
4 | 4 | ||
diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs index e19b197d9..cce789972 100644 --- a/crates/ra_assists/src/handlers/auto_import.rs +++ b/crates/ra_assists/src/handlers/auto_import.rs | |||
@@ -5,7 +5,7 @@ use hir::{ | |||
5 | AsAssocItem, AssocItemContainer, ModPath, Module, ModuleDef, PathResolution, Semantics, Trait, | 5 | AsAssocItem, AssocItemContainer, ModPath, Module, ModuleDef, PathResolution, Semantics, Trait, |
6 | Type, | 6 | Type, |
7 | }; | 7 | }; |
8 | use ra_ide_db::{imports_locator, RootDatabase}; | 8 | use ide_db::{imports_locator, RootDatabase}; |
9 | use rustc_hash::FxHashSet; | 9 | use rustc_hash::FxHashSet; |
10 | use syntax::{ | 10 | use syntax::{ |
11 | ast::{self, AstNode}, | 11 | ast::{self, AstNode}, |
diff --git a/crates/ra_assists/src/handlers/expand_glob_import.rs b/crates/ra_assists/src/handlers/expand_glob_import.rs index cf34ffaf7..f690ec343 100644 --- a/crates/ra_assists/src/handlers/expand_glob_import.rs +++ b/crates/ra_assists/src/handlers/expand_glob_import.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use hir::{AssocItem, MacroDef, ModuleDef, Name, PathResolution, ScopeDef, SemanticsScope}; | 1 | use hir::{AssocItem, MacroDef, ModuleDef, Name, PathResolution, ScopeDef, SemanticsScope}; |
2 | use ra_ide_db::{ | 2 | use ide_db::{ |
3 | defs::{classify_name_ref, Definition, NameRefClass}, | 3 | defs::{classify_name_ref, Definition, NameRefClass}, |
4 | RootDatabase, | 4 | RootDatabase, |
5 | }; | 5 | }; |
diff --git a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs index 52fbc540e..4bcdae7ba 100644 --- a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use base_db::FileId; | 1 | use base_db::FileId; |
2 | use hir::{EnumVariant, Module, ModuleDef, Name}; | 2 | use hir::{EnumVariant, Module, ModuleDef, Name}; |
3 | use ra_ide_db::{defs::Definition, search::Reference, RootDatabase}; | 3 | use ide_db::{defs::Definition, search::Reference, RootDatabase}; |
4 | use rustc_hash::FxHashSet; | 4 | use rustc_hash::FxHashSet; |
5 | use syntax::{ | 5 | use syntax::{ |
6 | algo::find_node_at_offset, | 6 | algo::find_node_at_offset, |
diff --git a/crates/ra_assists/src/handlers/fill_match_arms.rs b/crates/ra_assists/src/handlers/fill_match_arms.rs index 8f6660637..3d9bdb2bf 100644 --- a/crates/ra_assists/src/handlers/fill_match_arms.rs +++ b/crates/ra_assists/src/handlers/fill_match_arms.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | use std::iter; | 1 | use std::iter; |
2 | 2 | ||
3 | use hir::{Adt, HasSource, ModuleDef, Semantics}; | 3 | use hir::{Adt, HasSource, ModuleDef, Semantics}; |
4 | use ide_db::RootDatabase; | ||
4 | use itertools::Itertools; | 5 | use itertools::Itertools; |
5 | use ra_ide_db::RootDatabase; | ||
6 | use syntax::ast::{self, make, AstNode, MatchArm, NameOwner, Pat}; | 6 | use syntax::ast::{self, make, AstNode, MatchArm, NameOwner, Pat}; |
7 | use test_utils::mark; | 7 | use test_utils::mark; |
8 | 8 | ||
diff --git a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs index 302b6b67d..7f04b9572 100644 --- a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs +++ b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ra_ide_db::RootDatabase; | 1 | use ide_db::RootDatabase; |
2 | use syntax::ast::{self, AstNode, NameOwner}; | 2 | use syntax::ast::{self, AstNode, NameOwner}; |
3 | use test_utils::mark; | 3 | use test_utils::mark; |
4 | 4 | ||
diff --git a/crates/ra_assists/src/handlers/inline_local_variable.rs b/crates/ra_assists/src/handlers/inline_local_variable.rs index 531592320..2b52b333b 100644 --- a/crates/ra_assists/src/handlers/inline_local_variable.rs +++ b/crates/ra_assists/src/handlers/inline_local_variable.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ra_ide_db::defs::Definition; | 1 | use ide_db::defs::Definition; |
2 | use syntax::{ | 2 | use syntax::{ |
3 | ast::{self, AstNode, AstToken}, | 3 | ast::{self, AstNode, AstToken}, |
4 | TextRange, | 4 | TextRange, |
diff --git a/crates/ra_assists/src/handlers/reorder_fields.rs b/crates/ra_assists/src/handlers/reorder_fields.rs index 013720dfc..527f457a7 100644 --- a/crates/ra_assists/src/handlers/reorder_fields.rs +++ b/crates/ra_assists/src/handlers/reorder_fields.rs | |||
@@ -2,7 +2,7 @@ use itertools::Itertools; | |||
2 | use rustc_hash::FxHashMap; | 2 | use rustc_hash::FxHashMap; |
3 | 3 | ||
4 | use hir::{Adt, ModuleDef, PathResolution, Semantics, Struct}; | 4 | use hir::{Adt, ModuleDef, PathResolution, Semantics, Struct}; |
5 | use ra_ide_db::RootDatabase; | 5 | use ide_db::RootDatabase; |
6 | use syntax::{algo, ast, match_ast, AstNode, SyntaxKind, SyntaxKind::*, SyntaxNode}; | 6 | use syntax::{algo, ast, match_ast, AstNode, SyntaxKind, SyntaxKind::*, SyntaxNode}; |
7 | 7 | ||
8 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 8 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index 5d062b88b..f0cf35caf 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs | |||
@@ -19,7 +19,7 @@ pub mod ast_transform; | |||
19 | 19 | ||
20 | use base_db::FileRange; | 20 | use base_db::FileRange; |
21 | use hir::Semantics; | 21 | use hir::Semantics; |
22 | use ra_ide_db::{source_change::SourceChange, RootDatabase}; | 22 | use ide_db::{source_change::SourceChange, RootDatabase}; |
23 | use syntax::TextRange; | 23 | use syntax::TextRange; |
24 | 24 | ||
25 | pub(crate) use crate::assist_context::{AssistContext, Assists}; | 25 | pub(crate) use crate::assist_context::{AssistContext, Assists}; |
diff --git a/crates/ra_assists/src/tests.rs b/crates/ra_assists/src/tests.rs index 75d973688..ba1fb543b 100644 --- a/crates/ra_assists/src/tests.rs +++ b/crates/ra_assists/src/tests.rs | |||
@@ -2,7 +2,7 @@ mod generated; | |||
2 | 2 | ||
3 | use base_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; | 3 | use base_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; |
4 | use hir::Semantics; | 4 | use hir::Semantics; |
5 | use ra_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}; |
8 | 8 | ||
diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs index a20453dd8..84ccacafe 100644 --- a/crates/ra_assists/src/utils.rs +++ b/crates/ra_assists/src/utils.rs | |||
@@ -4,8 +4,8 @@ pub(crate) mod insert_use; | |||
4 | use std::{iter, ops}; | 4 | use std::{iter, ops}; |
5 | 5 | ||
6 | use hir::{Adt, Crate, Enum, ScopeDef, Semantics, Trait, Type}; | 6 | use hir::{Adt, Crate, Enum, ScopeDef, Semantics, Trait, Type}; |
7 | use ide_db::RootDatabase; | ||
7 | use itertools::Itertools; | 8 | use itertools::Itertools; |
8 | use ra_ide_db::RootDatabase; | ||
9 | use rustc_hash::FxHashSet; | 9 | use rustc_hash::FxHashSet; |
10 | use syntax::{ | 10 | use syntax::{ |
11 | ast::{self, make, NameOwner}, | 11 | ast::{self, make, NameOwner}, |
diff --git a/crates/ra_ide/Cargo.toml b/crates/ra_ide/Cargo.toml index a701cdf1d..e25aad6cf 100644 --- a/crates/ra_ide/Cargo.toml +++ b/crates/ra_ide/Cargo.toml | |||
@@ -24,7 +24,7 @@ stdx = { path = "../stdx" } | |||
24 | syntax = { path = "../syntax" } | 24 | syntax = { path = "../syntax" } |
25 | text_edit = { path = "../text_edit" } | 25 | text_edit = { path = "../text_edit" } |
26 | base_db = { path = "../base_db" } | 26 | base_db = { path = "../base_db" } |
27 | ra_ide_db = { path = "../ra_ide_db" } | 27 | ide_db = { path = "../ide_db" } |
28 | cfg = { path = "../cfg" } | 28 | cfg = { path = "../cfg" } |
29 | profile = { path = "../profile" } | 29 | profile = { path = "../profile" } |
30 | test_utils = { path = "../test_utils" } | 30 | test_utils = { path = "../test_utils" } |
diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs index 3578b8d3c..58e26b94c 100644 --- a/crates/ra_ide/src/call_hierarchy.rs +++ b/crates/ra_ide/src/call_hierarchy.rs | |||
@@ -3,7 +3,7 @@ | |||
3 | use indexmap::IndexMap; | 3 | use indexmap::IndexMap; |
4 | 4 | ||
5 | use hir::Semantics; | 5 | use hir::Semantics; |
6 | use ra_ide_db::RootDatabase; | 6 | use ide_db::RootDatabase; |
7 | use syntax::{ast, match_ast, AstNode, TextRange}; | 7 | use syntax::{ast, match_ast, AstNode, TextRange}; |
8 | 8 | ||
9 | use crate::{ | 9 | use crate::{ |
diff --git a/crates/ra_ide/src/call_info.rs b/crates/ra_ide/src/call_info.rs index 703cbc6b4..86abd2d8c 100644 --- a/crates/ra_ide/src/call_info.rs +++ b/crates/ra_ide/src/call_info.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | use either::Either; | 2 | use either::Either; |
3 | use hir::{Docs, HirDisplay, Semantics, Type}; | 3 | use hir::{Docs, HirDisplay, Semantics, Type}; |
4 | use ra_ide_db::RootDatabase; | 4 | use ide_db::RootDatabase; |
5 | use stdx::format_to; | 5 | use stdx::format_to; |
6 | use syntax::{ | 6 | use syntax::{ |
7 | ast::{self, ArgListOwner}, | 7 | ast::{self, ArgListOwner}, |
diff --git a/crates/ra_ide/src/completion.rs b/crates/ra_ide/src/completion.rs index 68ac05e4c..7fb4d687e 100644 --- a/crates/ra_ide/src/completion.rs +++ b/crates/ra_ide/src/completion.rs | |||
@@ -19,7 +19,7 @@ mod complete_postfix; | |||
19 | mod complete_macro_in_item_position; | 19 | mod complete_macro_in_item_position; |
20 | mod complete_trait_impl; | 20 | mod complete_trait_impl; |
21 | 21 | ||
22 | use ra_ide_db::RootDatabase; | 22 | use ide_db::RootDatabase; |
23 | 23 | ||
24 | use crate::{ | 24 | use crate::{ |
25 | completion::{ | 25 | completion::{ |
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index 0e0a201d0..047ecd9d7 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use base_db::SourceDatabase; | 3 | use base_db::SourceDatabase; |
4 | use hir::{Semantics, SemanticsScope, Type}; | 4 | use hir::{Semantics, SemanticsScope, Type}; |
5 | use ra_ide_db::RootDatabase; | 5 | use ide_db::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}, |
8 | ast, match_ast, AstNode, NodeOrToken, | 8 | ast, match_ast, AstNode, NodeOrToken, |
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index 4e59e3a48..a3ec98178 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs | |||
@@ -8,8 +8,8 @@ use std::cell::RefCell; | |||
8 | 8 | ||
9 | use base_db::SourceDatabase; | 9 | use base_db::SourceDatabase; |
10 | use hir::{diagnostics::DiagnosticSinkBuilder, Semantics}; | 10 | use hir::{diagnostics::DiagnosticSinkBuilder, Semantics}; |
11 | use ide_db::RootDatabase; | ||
11 | use itertools::Itertools; | 12 | use itertools::Itertools; |
12 | use ra_ide_db::RootDatabase; | ||
13 | use syntax::{ | 13 | use syntax::{ |
14 | ast::{self, AstNode}, | 14 | ast::{self, AstNode}, |
15 | SyntaxNode, TextRange, T, | 15 | SyntaxNode, TextRange, T, |
diff --git a/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs b/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs index 7e126d7a6..85b46c995 100644 --- a/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs +++ b/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs | |||
@@ -8,7 +8,7 @@ use hir::{ | |||
8 | diagnostics::{Diagnostic, MissingFields, MissingOkInTailExpr, NoSuchField, UnresolvedModule}, | 8 | diagnostics::{Diagnostic, MissingFields, MissingOkInTailExpr, NoSuchField, UnresolvedModule}, |
9 | HasSource, HirDisplay, Semantics, VariantDef, | 9 | HasSource, HirDisplay, Semantics, VariantDef, |
10 | }; | 10 | }; |
11 | use ra_ide_db::{ | 11 | use ide_db::{ |
12 | source_change::{FileSystemEdit, SourceFileEdit}, | 12 | source_change::{FileSystemEdit, SourceFileEdit}, |
13 | RootDatabase, | 13 | RootDatabase, |
14 | }; | 14 | }; |
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 09ec3f65e..e77106177 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs | |||
@@ -3,7 +3,7 @@ | |||
3 | use base_db::{FileId, SourceDatabase}; | 3 | use base_db::{FileId, SourceDatabase}; |
4 | use either::Either; | 4 | use either::Either; |
5 | use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource}; | 5 | use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource}; |
6 | use ra_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}, |
9 | match_ast, AstNode, SmolStr, | 9 | match_ast, AstNode, SmolStr, |
diff --git a/crates/ra_ide/src/expand_macro.rs b/crates/ra_ide/src/expand_macro.rs index c25e068d6..31455709d 100644 --- a/crates/ra_ide/src/expand_macro.rs +++ b/crates/ra_ide/src/expand_macro.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use hir::Semantics; | 1 | use hir::Semantics; |
2 | use ra_ide_db::RootDatabase; | 2 | use ide_db::RootDatabase; |
3 | use syntax::{ | 3 | use syntax::{ |
4 | algo::{find_node_at_offset, SyntaxRewriter}, | 4 | algo::{find_node_at_offset, SyntaxRewriter}, |
5 | ast, AstNode, NodeOrToken, SyntaxKind, | 5 | ast, AstNode, NodeOrToken, SyntaxKind, |
diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index f30df2bff..34563a026 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use std::iter::successors; | 1 | use std::iter::successors; |
2 | 2 | ||
3 | use hir::Semantics; | 3 | use hir::Semantics; |
4 | use ra_ide_db::RootDatabase; | 4 | use ide_db::RootDatabase; |
5 | use syntax::{ | 5 | use syntax::{ |
6 | algo::{self, find_covering_element, skip_trivia_token}, | 6 | algo::{self, find_covering_element, skip_trivia_token}, |
7 | ast::{self, AstNode, AstToken}, | 7 | ast::{self, AstNode, AstToken}, |
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index b93d116bf..15e9b7fad 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use hir::Semantics; | 1 | use hir::Semantics; |
2 | use ra_ide_db::{ | 2 | use ide_db::{ |
3 | defs::{classify_name, classify_name_ref}, | 3 | defs::{classify_name, classify_name_ref}, |
4 | symbol_index, RootDatabase, | 4 | symbol_index, RootDatabase, |
5 | }; | 5 | }; |
diff --git a/crates/ra_ide/src/goto_implementation.rs b/crates/ra_ide/src/goto_implementation.rs index 6dc2ccfd0..f503f4ec5 100644 --- a/crates/ra_ide/src/goto_implementation.rs +++ b/crates/ra_ide/src/goto_implementation.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use hir::{Crate, ImplDef, Semantics}; | 1 | use hir::{Crate, ImplDef, Semantics}; |
2 | use ra_ide_db::RootDatabase; | 2 | use ide_db::RootDatabase; |
3 | use syntax::{algo::find_node_at_offset, ast, AstNode}; | 3 | use syntax::{algo::find_node_at_offset, ast, AstNode}; |
4 | 4 | ||
5 | use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; | 5 | use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; |
diff --git a/crates/ra_ide/src/goto_type_definition.rs b/crates/ra_ide/src/goto_type_definition.rs index 8017ca58c..4a151b150 100644 --- a/crates/ra_ide/src/goto_type_definition.rs +++ b/crates/ra_ide/src/goto_type_definition.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ra_ide_db::RootDatabase; | 1 | use ide_db::RootDatabase; |
2 | use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T}; | 2 | use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T}; |
3 | 3 | ||
4 | use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; | 4 | use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; |
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index a74087f87..331aa4db0 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -3,11 +3,11 @@ use hir::{ | |||
3 | Adt, AsAssocItem, AssocItemContainer, Documentation, FieldSource, HasSource, HirDisplay, | 3 | Adt, AsAssocItem, AssocItemContainer, Documentation, FieldSource, HasSource, HirDisplay, |
4 | Module, ModuleDef, ModuleSource, Semantics, | 4 | Module, ModuleDef, ModuleSource, Semantics, |
5 | }; | 5 | }; |
6 | use itertools::Itertools; | 6 | use ide_db::{ |
7 | use ra_ide_db::{ | ||
8 | defs::{classify_name, classify_name_ref, Definition}, | 7 | defs::{classify_name, classify_name_ref, Definition}, |
9 | RootDatabase, | 8 | RootDatabase, |
10 | }; | 9 | }; |
10 | use itertools::Itertools; | ||
11 | use stdx::format_to; | 11 | use stdx::format_to; |
12 | use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T}; | 12 | use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T}; |
13 | use test_utils::mark; | 13 | use test_utils::mark; |
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index 81fe274ad..002adf915 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use hir::{Adt, Callable, HirDisplay, Semantics, Type}; | 1 | use hir::{Adt, Callable, HirDisplay, Semantics, Type}; |
2 | use ra_ide_db::RootDatabase; | 2 | use ide_db::RootDatabase; |
3 | use stdx::to_lower_snake_case; | 3 | use stdx::to_lower_snake_case; |
4 | use syntax::{ | 4 | use syntax::{ |
5 | ast::{self, ArgListOwner, AstNode}, | 5 | ast::{self, ArgListOwner, AstNode}, |
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 0d14c823a..66a234fff 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs | |||
@@ -52,7 +52,7 @@ use base_db::{ | |||
52 | CheckCanceled, Env, FileLoader, FileSet, SourceDatabase, VfsPath, | 52 | CheckCanceled, Env, FileLoader, FileSet, SourceDatabase, VfsPath, |
53 | }; | 53 | }; |
54 | use cfg::CfgOptions; | 54 | use cfg::CfgOptions; |
55 | use ra_ide_db::{ | 55 | use ide_db::{ |
56 | symbol_index::{self, FileSymbol}, | 56 | symbol_index::{self, FileSymbol}, |
57 | LineIndexDatabase, | 57 | LineIndexDatabase, |
58 | }; | 58 | }; |
@@ -86,8 +86,7 @@ pub use base_db::{ | |||
86 | SourceRootId, | 86 | SourceRootId, |
87 | }; | 87 | }; |
88 | pub use hir::{Documentation, Semantics}; | 88 | pub use hir::{Documentation, Semantics}; |
89 | pub use ra_assists::{Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist}; | 89 | pub use ide_db::{ |
90 | pub use ra_ide_db::{ | ||
91 | change::AnalysisChange, | 90 | change::AnalysisChange, |
92 | line_index::{LineCol, LineIndex}, | 91 | line_index::{LineCol, LineIndex}, |
93 | search::SearchScope, | 92 | search::SearchScope, |
@@ -95,6 +94,7 @@ pub use ra_ide_db::{ | |||
95 | symbol_index::Query, | 94 | symbol_index::Query, |
96 | RootDatabase, | 95 | RootDatabase, |
97 | }; | 96 | }; |
97 | pub use ra_assists::{Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist}; | ||
98 | pub use ra_ssr::SsrError; | 98 | pub use ra_ssr::SsrError; |
99 | pub use text_edit::{Indel, TextEdit}; | 99 | pub use text_edit::{Indel, TextEdit}; |
100 | 100 | ||
diff --git a/crates/ra_ide/src/parent_module.rs b/crates/ra_ide/src/parent_module.rs index 8439e1d5d..59ed2967c 100644 --- a/crates/ra_ide/src/parent_module.rs +++ b/crates/ra_ide/src/parent_module.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use base_db::{CrateId, FileId, FilePosition}; | 1 | use base_db::{CrateId, FileId, FilePosition}; |
2 | use hir::Semantics; | 2 | use hir::Semantics; |
3 | use ra_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, |
6 | ast::{self, AstNode}, | 6 | ast::{self, AstNode}, |
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index e89dca869..0a76ec6b4 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs | |||
@@ -12,7 +12,7 @@ | |||
12 | mod rename; | 12 | mod rename; |
13 | 13 | ||
14 | use hir::Semantics; | 14 | use hir::Semantics; |
15 | use ra_ide_db::{ | 15 | use ide_db::{ |
16 | defs::{classify_name, classify_name_ref, Definition}, | 16 | defs::{classify_name, classify_name_ref, Definition}, |
17 | search::SearchScope, | 17 | search::SearchScope, |
18 | RootDatabase, | 18 | RootDatabase, |
@@ -27,7 +27,7 @@ use crate::{display::TryToNav, FilePosition, FileRange, NavigationTarget, RangeI | |||
27 | 27 | ||
28 | pub(crate) use self::rename::rename; | 28 | pub(crate) use self::rename::rename; |
29 | 29 | ||
30 | pub use ra_ide_db::search::{Reference, ReferenceAccess, ReferenceKind}; | 30 | pub use ide_db::search::{Reference, ReferenceAccess, ReferenceKind}; |
31 | 31 | ||
32 | #[derive(Debug, Clone)] | 32 | #[derive(Debug, Clone)] |
33 | pub struct ReferenceSearchResult { | 33 | pub struct ReferenceSearchResult { |
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index 5697b9d87..d73dc9cd0 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use base_db::SourceDatabaseExt; | 3 | use base_db::SourceDatabaseExt; |
4 | use hir::{Module, ModuleDef, ModuleSource, Semantics}; | 4 | use hir::{Module, ModuleDef, ModuleSource, Semantics}; |
5 | use ra_ide_db::{ | 5 | use ide_db::{ |
6 | defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, | 6 | defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, |
7 | RootDatabase, | 7 | RootDatabase, |
8 | }; | 8 | }; |
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs index fb40762cf..c3e07c8de 100644 --- a/crates/ra_ide/src/runnables.rs +++ b/crates/ra_ide/src/runnables.rs | |||
@@ -2,8 +2,8 @@ use std::fmt; | |||
2 | 2 | ||
3 | use cfg::CfgExpr; | 3 | use cfg::CfgExpr; |
4 | use hir::{AsAssocItem, Attrs, HirFileId, InFile, Semantics}; | 4 | use hir::{AsAssocItem, Attrs, HirFileId, InFile, Semantics}; |
5 | use ide_db::RootDatabase; | ||
5 | use itertools::Itertools; | 6 | use itertools::Itertools; |
6 | use ra_ide_db::RootDatabase; | ||
7 | use syntax::{ | 7 | use syntax::{ |
8 | ast::{self, AstNode, AttrsOwner, DocCommentsOwner, ModuleItemOwner, NameOwner}, | 8 | ast::{self, AstNode, AttrsOwner, DocCommentsOwner, ModuleItemOwner, NameOwner}, |
9 | match_ast, SyntaxNode, | 9 | match_ast, SyntaxNode, |
diff --git a/crates/ra_ide/src/ssr.rs b/crates/ra_ide/src/ssr.rs index 97b82b70e..a8a704192 100644 --- a/crates/ra_ide/src/ssr.rs +++ b/crates/ra_ide/src/ssr.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use base_db::{FilePosition, FileRange}; | 1 | use base_db::{FilePosition, FileRange}; |
2 | use ra_ide_db::RootDatabase; | 2 | use ide_db::RootDatabase; |
3 | 3 | ||
4 | use crate::SourceFileEdit; | 4 | use crate::SourceFileEdit; |
5 | use ra_ssr::{MatchFinder, SsrError, SsrRule}; | 5 | use ra_ssr::{MatchFinder, SsrError, SsrRule}; |
diff --git a/crates/ra_ide/src/status.rs b/crates/ra_ide/src/status.rs index 869c74acc..c23708181 100644 --- a/crates/ra_ide/src/status.rs +++ b/crates/ra_ide/src/status.rs | |||
@@ -5,11 +5,11 @@ use base_db::{ | |||
5 | FileTextQuery, SourceRootId, | 5 | FileTextQuery, SourceRootId, |
6 | }; | 6 | }; |
7 | use hir::MacroFile; | 7 | use hir::MacroFile; |
8 | use profile::{memory_usage, Bytes}; | 8 | use ide_db::{ |
9 | use ra_ide_db::{ | ||
10 | symbol_index::{LibrarySymbolsQuery, SymbolIndex}, | 9 | symbol_index::{LibrarySymbolsQuery, SymbolIndex}, |
11 | RootDatabase, | 10 | RootDatabase, |
12 | }; | 11 | }; |
12 | use profile::{memory_usage, Bytes}; | ||
13 | use rustc_hash::FxHashMap; | 13 | use rustc_hash::FxHashMap; |
14 | use syntax::{ast, Parse, SyntaxNode}; | 14 | use syntax::{ast, Parse, SyntaxNode}; |
15 | 15 | ||
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 4b41ceb1d..5d7c7e8d0 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -5,7 +5,7 @@ mod injection; | |||
5 | mod tests; | 5 | mod tests; |
6 | 6 | ||
7 | use hir::{Name, Semantics, VariantDef}; | 7 | use hir::{Name, Semantics, VariantDef}; |
8 | use ra_ide_db::{ | 8 | use ide_db::{ |
9 | defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, | 9 | defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, |
10 | RootDatabase, | 10 | RootDatabase, |
11 | }; | 11 | }; |
diff --git a/crates/ra_ide/src/syntax_tree.rs b/crates/ra_ide/src/syntax_tree.rs index 17daf06b6..f80044959 100644 --- a/crates/ra_ide/src/syntax_tree.rs +++ b/crates/ra_ide/src/syntax_tree.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use base_db::{FileId, SourceDatabase}; | 1 | use base_db::{FileId, SourceDatabase}; |
2 | use ra_ide_db::RootDatabase; | 2 | use ide_db::RootDatabase; |
3 | use syntax::{ | 3 | use syntax::{ |
4 | algo, AstNode, NodeOrToken, SourceFile, | 4 | algo, AstNode, NodeOrToken, SourceFile, |
5 | SyntaxKind::{RAW_STRING, STRING}, | 5 | SyntaxKind::{RAW_STRING, STRING}, |
diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs index 75f2a6b60..899ce5f26 100644 --- a/crates/ra_ide/src/typing.rs +++ b/crates/ra_ide/src/typing.rs | |||
@@ -16,7 +16,7 @@ | |||
16 | mod on_enter; | 16 | mod on_enter; |
17 | 17 | ||
18 | use base_db::{FilePosition, SourceDatabase}; | 18 | use base_db::{FilePosition, SourceDatabase}; |
19 | use ra_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, |
22 | ast::{self, edit::IndentLevel, AstToken}, | 22 | ast::{self, edit::IndentLevel, AstToken}, |
diff --git a/crates/ra_ide/src/typing/on_enter.rs b/crates/ra_ide/src/typing/on_enter.rs index 193930659..f7d46146c 100644 --- a/crates/ra_ide/src/typing/on_enter.rs +++ b/crates/ra_ide/src/typing/on_enter.rs | |||
@@ -2,7 +2,7 @@ | |||
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 base_db::{FilePosition, SourceDatabase}; |
5 | use ra_ide_db::RootDatabase; | 5 | use ide_db::RootDatabase; |
6 | use syntax::{ | 6 | use syntax::{ |
7 | ast::{self, AstToken}, | 7 | ast::{self, AstToken}, |
8 | AstNode, SmolStr, SourceFile, | 8 | AstNode, SmolStr, SourceFile, |
diff --git a/crates/ra_ssr/Cargo.toml b/crates/ra_ssr/Cargo.toml index bed4bbdf1..4d22a8a98 100644 --- a/crates/ra_ssr/Cargo.toml +++ b/crates/ra_ssr/Cargo.toml | |||
@@ -14,7 +14,7 @@ doctest = false | |||
14 | text_edit = { path = "../text_edit" } | 14 | text_edit = { path = "../text_edit" } |
15 | syntax = { path = "../syntax" } | 15 | syntax = { path = "../syntax" } |
16 | base_db = { path = "../base_db" } | 16 | base_db = { path = "../base_db" } |
17 | ra_ide_db = { path = "../ra_ide_db" } | 17 | ide_db = { path = "../ide_db" } |
18 | hir = { path = "../hir" } | 18 | hir = { path = "../hir" } |
19 | rustc-hash = "1.1.0" | 19 | rustc-hash = "1.1.0" |
20 | test_utils = { path = "../test_utils" } | 20 | test_utils = { path = "../test_utils" } |
diff --git a/crates/ra_ssr/src/lib.rs b/crates/ra_ssr/src/lib.rs index 6725582e4..b4e35107e 100644 --- a/crates/ra_ssr/src/lib.rs +++ b/crates/ra_ssr/src/lib.rs | |||
@@ -20,7 +20,7 @@ pub use crate::matching::Match; | |||
20 | use crate::matching::MatchFailureReason; | 20 | use crate::matching::MatchFailureReason; |
21 | use base_db::{FileId, FilePosition, FileRange}; | 21 | use base_db::{FileId, FilePosition, FileRange}; |
22 | use hir::Semantics; | 22 | use hir::Semantics; |
23 | use ra_ide_db::source_change::SourceFileEdit; | 23 | use ide_db::source_change::SourceFileEdit; |
24 | use resolving::ResolvedRule; | 24 | use resolving::ResolvedRule; |
25 | use rustc_hash::FxHashMap; | 25 | use rustc_hash::FxHashMap; |
26 | use syntax::{ast, AstNode, SyntaxNode, TextRange}; | 26 | use syntax::{ast, AstNode, SyntaxNode, TextRange}; |
@@ -49,7 +49,7 @@ pub struct SsrMatches { | |||
49 | /// Searches a crate for pattern matches and possibly replaces them with something else. | 49 | /// Searches a crate for pattern matches and possibly replaces them with something else. |
50 | pub struct MatchFinder<'db> { | 50 | pub struct MatchFinder<'db> { |
51 | /// Our source of information about the user's code. | 51 | /// Our source of information about the user's code. |
52 | sema: Semantics<'db, ra_ide_db::RootDatabase>, | 52 | sema: Semantics<'db, ide_db::RootDatabase>, |
53 | rules: Vec<ResolvedRule>, | 53 | rules: Vec<ResolvedRule>, |
54 | resolution_scope: resolving::ResolutionScope<'db>, | 54 | resolution_scope: resolving::ResolutionScope<'db>, |
55 | restrict_ranges: Vec<FileRange>, | 55 | restrict_ranges: Vec<FileRange>, |
@@ -59,7 +59,7 @@ impl<'db> MatchFinder<'db> { | |||
59 | /// Constructs a new instance where names will be looked up as if they appeared at | 59 | /// Constructs a new instance where names will be looked up as if they appeared at |
60 | /// `lookup_context`. | 60 | /// `lookup_context`. |
61 | pub fn in_context( | 61 | pub fn in_context( |
62 | db: &'db ra_ide_db::RootDatabase, | 62 | db: &'db ide_db::RootDatabase, |
63 | lookup_context: FilePosition, | 63 | lookup_context: FilePosition, |
64 | mut restrict_ranges: Vec<FileRange>, | 64 | mut restrict_ranges: Vec<FileRange>, |
65 | ) -> MatchFinder<'db> { | 65 | ) -> MatchFinder<'db> { |
@@ -70,9 +70,9 @@ impl<'db> MatchFinder<'db> { | |||
70 | } | 70 | } |
71 | 71 | ||
72 | /// Constructs an instance using the start of the first file in `db` as the lookup context. | 72 | /// Constructs an instance using the start of the first file in `db` as the lookup context. |
73 | pub fn at_first_file(db: &'db ra_ide_db::RootDatabase) -> Result<MatchFinder<'db>, SsrError> { | 73 | pub fn at_first_file(db: &'db ide_db::RootDatabase) -> Result<MatchFinder<'db>, SsrError> { |
74 | use base_db::SourceDatabaseExt; | 74 | use base_db::SourceDatabaseExt; |
75 | use ra_ide_db::symbol_index::SymbolsDatabase; | 75 | use ide_db::symbol_index::SymbolsDatabase; |
76 | if let Some(first_file_id) = db | 76 | if let Some(first_file_id) = db |
77 | .local_roots() | 77 | .local_roots() |
78 | .iter() | 78 | .iter() |
diff --git a/crates/ra_ssr/src/matching.rs b/crates/ra_ssr/src/matching.rs index e81a87c47..ffc7202ae 100644 --- a/crates/ra_ssr/src/matching.rs +++ b/crates/ra_ssr/src/matching.rs | |||
@@ -92,7 +92,7 @@ pub(crate) fn get_match( | |||
92 | rule: &ResolvedRule, | 92 | rule: &ResolvedRule, |
93 | code: &SyntaxNode, | 93 | code: &SyntaxNode, |
94 | restrict_range: &Option<FileRange>, | 94 | restrict_range: &Option<FileRange>, |
95 | sema: &Semantics<ra_ide_db::RootDatabase>, | 95 | sema: &Semantics<ide_db::RootDatabase>, |
96 | ) -> Result<Match, MatchFailed> { | 96 | ) -> Result<Match, MatchFailed> { |
97 | record_match_fails_reasons_scope(debug_active, || { | 97 | record_match_fails_reasons_scope(debug_active, || { |
98 | Matcher::try_match(rule, code, restrict_range, sema) | 98 | Matcher::try_match(rule, code, restrict_range, sema) |
@@ -101,7 +101,7 @@ pub(crate) fn get_match( | |||
101 | 101 | ||
102 | /// Checks if our search pattern matches a particular node of the AST. | 102 | /// Checks if our search pattern matches a particular node of the AST. |
103 | struct Matcher<'db, 'sema> { | 103 | struct Matcher<'db, 'sema> { |
104 | sema: &'sema Semantics<'db, ra_ide_db::RootDatabase>, | 104 | sema: &'sema Semantics<'db, ide_db::RootDatabase>, |
105 | /// If any placeholders come from anywhere outside of this range, then the match will be | 105 | /// If any placeholders come from anywhere outside of this range, then the match will be |
106 | /// rejected. | 106 | /// rejected. |
107 | restrict_range: Option<FileRange>, | 107 | restrict_range: Option<FileRange>, |
@@ -123,7 +123,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> { | |||
123 | rule: &ResolvedRule, | 123 | rule: &ResolvedRule, |
124 | code: &SyntaxNode, | 124 | code: &SyntaxNode, |
125 | restrict_range: &Option<FileRange>, | 125 | restrict_range: &Option<FileRange>, |
126 | sema: &'sema Semantics<'db, ra_ide_db::RootDatabase>, | 126 | sema: &'sema Semantics<'db, ide_db::RootDatabase>, |
127 | ) -> Result<Match, MatchFailed> { | 127 | ) -> Result<Match, MatchFailed> { |
128 | let match_state = Matcher { sema, restrict_range: restrict_range.clone(), rule }; | 128 | let match_state = Matcher { sema, restrict_range: restrict_range.clone(), rule }; |
129 | // First pass at matching, where we check that node types and idents match. | 129 | // First pass at matching, where we check that node types and idents match. |
@@ -606,7 +606,7 @@ impl Match { | |||
606 | fn render_template_paths( | 606 | fn render_template_paths( |
607 | &mut self, | 607 | &mut self, |
608 | template: &ResolvedPattern, | 608 | template: &ResolvedPattern, |
609 | sema: &Semantics<ra_ide_db::RootDatabase>, | 609 | sema: &Semantics<ide_db::RootDatabase>, |
610 | ) -> Result<(), MatchFailed> { | 610 | ) -> Result<(), MatchFailed> { |
611 | let module = sema | 611 | let module = sema |
612 | .scope(&self.matched_node) | 612 | .scope(&self.matched_node) |
diff --git a/crates/ra_ssr/src/nester.rs b/crates/ra_ssr/src/nester.rs index 8be570d3c..6ac355dfc 100644 --- a/crates/ra_ssr/src/nester.rs +++ b/crates/ra_ssr/src/nester.rs | |||
@@ -13,7 +13,7 @@ use syntax::SyntaxNode; | |||
13 | 13 | ||
14 | pub(crate) fn nest_and_remove_collisions( | 14 | pub(crate) fn nest_and_remove_collisions( |
15 | mut matches: Vec<Match>, | 15 | mut matches: Vec<Match>, |
16 | sema: &hir::Semantics<ra_ide_db::RootDatabase>, | 16 | sema: &hir::Semantics<ide_db::RootDatabase>, |
17 | ) -> SsrMatches { | 17 | ) -> SsrMatches { |
18 | // We sort the matches by depth then by rule index. Sorting by depth means that by the time we | 18 | // We sort the matches by depth then by rule index. Sorting by depth means that by the time we |
19 | // see a match, any parent matches or conflicting matches will have already been seen. Sorting | 19 | // see a match, any parent matches or conflicting matches will have already been seen. Sorting |
@@ -36,7 +36,7 @@ impl MatchCollector { | |||
36 | /// Attempts to add `m` to matches. If it conflicts with an existing match, it is discarded. If | 36 | /// Attempts to add `m` to matches. If it conflicts with an existing match, it is discarded. If |
37 | /// it is entirely within the a placeholder of an existing match, then it is added as a child | 37 | /// it is entirely within the a placeholder of an existing match, then it is added as a child |
38 | /// match of the existing match. | 38 | /// match of the existing match. |
39 | fn add_match(&mut self, m: Match, sema: &hir::Semantics<ra_ide_db::RootDatabase>) { | 39 | fn add_match(&mut self, m: Match, sema: &hir::Semantics<ide_db::RootDatabase>) { |
40 | let matched_node = m.matched_node.clone(); | 40 | let matched_node = m.matched_node.clone(); |
41 | if let Some(existing) = self.matches_by_node.get_mut(&matched_node) { | 41 | if let Some(existing) = self.matches_by_node.get_mut(&matched_node) { |
42 | try_add_sub_match(m, existing, sema); | 42 | try_add_sub_match(m, existing, sema); |
@@ -53,11 +53,7 @@ impl MatchCollector { | |||
53 | } | 53 | } |
54 | 54 | ||
55 | /// Attempts to add `m` as a sub-match of `existing`. | 55 | /// Attempts to add `m` as a sub-match of `existing`. |
56 | fn try_add_sub_match( | 56 | fn try_add_sub_match(m: Match, existing: &mut Match, sema: &hir::Semantics<ide_db::RootDatabase>) { |
57 | m: Match, | ||
58 | existing: &mut Match, | ||
59 | sema: &hir::Semantics<ra_ide_db::RootDatabase>, | ||
60 | ) { | ||
61 | for p in existing.placeholder_values.values_mut() { | 57 | for p in existing.placeholder_values.values_mut() { |
62 | // Note, no need to check if p.range.file is equal to m.range.file, since we | 58 | // Note, no need to check if p.range.file is equal to m.range.file, since we |
63 | // already know we're within `existing`. | 59 | // already know we're within `existing`. |
diff --git a/crates/ra_ssr/src/resolving.rs b/crates/ra_ssr/src/resolving.rs index dac09bae8..020fd7994 100644 --- a/crates/ra_ssr/src/resolving.rs +++ b/crates/ra_ssr/src/resolving.rs | |||
@@ -187,7 +187,7 @@ impl Resolver<'_, '_> { | |||
187 | 187 | ||
188 | impl<'db> ResolutionScope<'db> { | 188 | impl<'db> ResolutionScope<'db> { |
189 | pub(crate) fn new( | 189 | pub(crate) fn new( |
190 | sema: &hir::Semantics<'db, ra_ide_db::RootDatabase>, | 190 | sema: &hir::Semantics<'db, ide_db::RootDatabase>, |
191 | resolve_context: FilePosition, | 191 | resolve_context: FilePosition, |
192 | ) -> ResolutionScope<'db> { | 192 | ) -> ResolutionScope<'db> { |
193 | use syntax::ast::AstNode; | 193 | use syntax::ast::AstNode; |
diff --git a/crates/ra_ssr/src/search.rs b/crates/ra_ssr/src/search.rs index 434953fb4..8509cfa4d 100644 --- a/crates/ra_ssr/src/search.rs +++ b/crates/ra_ssr/src/search.rs | |||
@@ -6,7 +6,7 @@ use crate::{ | |||
6 | Match, MatchFinder, | 6 | Match, MatchFinder, |
7 | }; | 7 | }; |
8 | use base_db::{FileId, FileRange}; | 8 | use base_db::{FileId, FileRange}; |
9 | use ra_ide_db::{ | 9 | use ide_db::{ |
10 | defs::Definition, | 10 | defs::Definition, |
11 | search::{Reference, SearchScope}, | 11 | search::{Reference, SearchScope}, |
12 | }; | 12 | }; |
@@ -146,7 +146,7 @@ impl<'db> MatchFinder<'db> { | |||
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 base_db::SourceDatabaseExt; |
149 | use ra_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); |
152 | for file_id in sr.iter() { | 152 | for file_id in sr.iter() { |
diff --git a/crates/ra_ssr/src/tests.rs b/crates/ra_ssr/src/tests.rs index 54c3da9db..0d0a00090 100644 --- a/crates/ra_ssr/src/tests.rs +++ b/crates/ra_ssr/src/tests.rs | |||
@@ -61,13 +61,13 @@ fn parser_undefined_placeholder_in_replacement() { | |||
61 | 61 | ||
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) -> (ra_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 base_db::fixture::WithFixture; |
66 | use ra_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 | ra_ide_db::RootDatabase::with_range_or_offset(code) | 68 | ide_db::RootDatabase::with_range_or_offset(code) |
69 | } else { | 69 | } else { |
70 | let (db, file_id) = ra_ide_db::RootDatabase::with_single_file(code); | 70 | let (db, file_id) = ide_db::RootDatabase::with_single_file(code); |
71 | (db, file_id, RangeOrOffset::Offset(0.into())) | 71 | (db, file_id, RangeOrOffset::Offset(0.into())) |
72 | }; | 72 | }; |
73 | let selections; | 73 | let selections; |
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index c0257e9c8..da8c09c09 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml | |||
@@ -47,7 +47,7 @@ toolchain = { path = "../toolchain" } | |||
47 | 47 | ||
48 | # This should only be used in CLI | 48 | # This should only be used in CLI |
49 | base_db = { path = "../base_db" } | 49 | base_db = { path = "../base_db" } |
50 | ra_ide_db = { path = "../ra_ide_db" } | 50 | ide_db = { path = "../ide_db" } |
51 | ra_ssr = { path = "../ra_ssr" } | 51 | ra_ssr = { path = "../ra_ssr" } |
52 | hir = { path = "../hir" } | 52 | hir = { path = "../hir" } |
53 | hir_def = { path = "../hir_def" } | 53 | hir_def = { path = "../hir_def" } |
diff --git a/crates/rust-analyzer/src/cli/ssr.rs b/crates/rust-analyzer/src/cli/ssr.rs index 08788fb41..1357a93e1 100644 --- a/crates/rust-analyzer/src/cli/ssr.rs +++ b/crates/rust-analyzer/src/cli/ssr.rs | |||
@@ -27,7 +27,7 @@ pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> { | |||
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 base_db::SourceDatabaseExt; |
30 | use ra_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(); |
33 | let mut match_finder = MatchFinder::at_first_file(db)?; | 33 | let mut match_finder = MatchFinder::at_first_file(db)?; |