diff --git a/Cargo.lock b/Cargo.lock index ae71ea9fdb..8704e43860 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -562,6 +562,25 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "ide_db" +version = "0.0.0" +dependencies = [ + "base_db", + "either", + "fst", + "hir", + "log", + "once_cell", + "profile", + "rayon", + "rustc-hash", + "stdx", + "syntax", + "test_utils", + "text_edit", +] + [[package]] name = "idna" version = "0.2.0" @@ -1090,9 +1109,9 @@ dependencies = [ "base_db", "either", "hir", + "ide_db", "itertools", "profile", - "ra_ide_db", "rustc-hash", "stdx", "syntax", @@ -1109,13 +1128,13 @@ dependencies = [ "either", "expect", "hir", + "ide_db", "indexmap", "itertools", "log", "oorandom", "profile", "ra_assists", - "ra_ide_db", "ra_ssr", "rustc-hash", "stdx", @@ -1124,25 +1143,6 @@ dependencies = [ "text_edit", ] -[[package]] -name = "ra_ide_db" -version = "0.1.0" -dependencies = [ - "base_db", - "either", - "fst", - "hir", - "log", - "once_cell", - "profile", - "rayon", - "rustc-hash", - "stdx", - "syntax", - "test_utils", - "text_edit", -] - [[package]] name = "ra_ssr" version = "0.1.0" @@ -1150,7 +1150,7 @@ dependencies = [ "base_db", "expect", "hir", - "ra_ide_db", + "ide_db", "rustc-hash", "syntax", "test_utils", @@ -1239,6 +1239,7 @@ dependencies = [ "hir", "hir_def", "hir_ty", + "ide_db", "itertools", "jod-thread", "log", @@ -1253,7 +1254,6 @@ dependencies = [ "profile", "project_model", "ra_ide", - "ra_ide_db", "ra_ssr", "rayon", "rustc-hash", diff --git a/crates/ra_ide_db/Cargo.toml b/crates/ide_db/Cargo.toml similarity index 94% rename from crates/ra_ide_db/Cargo.toml rename to crates/ide_db/Cargo.toml index eda257a3a8..885212162f 100644 --- a/crates/ra_ide_db/Cargo.toml +++ b/crates/ide_db/Cargo.toml @@ -1,9 +1,9 @@ [package] -edition = "2018" -name = "ra_ide_db" -version = "0.1.0" -authors = ["rust-analyzer developers"] +name = "ide_db" +version = "0.0.0" license = "MIT OR Apache-2.0" +authors = ["rust-analyzer developers"] +edition = "2018" [lib] doctest = false @@ -20,13 +20,11 @@ once_cell = "1.3.1" either = "1.5.3" stdx = { path = "../stdx" } - syntax = { path = "../syntax" } text_edit = { path = "../text_edit" } base_db = { path = "../base_db" } profile = { path = "../profile" } test_utils = { path = "../test_utils" } - # ra_ide should depend only on the top-level `hir` package. if you need # something from some `hir_xxx` subpackage, reexport the API via `hir`. hir = { path = "../hir" } diff --git a/crates/ra_ide_db/src/change.rs b/crates/ide_db/src/change.rs similarity index 100% rename from crates/ra_ide_db/src/change.rs rename to crates/ide_db/src/change.rs diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ide_db/src/defs.rs similarity index 100% rename from crates/ra_ide_db/src/defs.rs rename to 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 similarity index 100% rename from crates/ra_ide_db/src/imports_locator.rs rename to crates/ide_db/src/imports_locator.rs diff --git a/crates/ra_ide_db/src/lib.rs b/crates/ide_db/src/lib.rs similarity index 100% rename from crates/ra_ide_db/src/lib.rs rename to 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 similarity index 100% rename from crates/ra_ide_db/src/line_index.rs rename to crates/ide_db/src/line_index.rs diff --git a/crates/ra_ide_db/src/search.rs b/crates/ide_db/src/search.rs similarity index 100% rename from crates/ra_ide_db/src/search.rs rename to 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 similarity index 100% rename from crates/ra_ide_db/src/source_change.rs rename to 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 similarity index 100% rename from crates/ra_ide_db/src/symbol_index.rs rename to 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 similarity index 100% rename from crates/ra_ide_db/src/wasm_shims.rs rename to crates/ide_db/src/wasm_shims.rs diff --git a/crates/ra_assists/Cargo.toml b/crates/ra_assists/Cargo.toml index cacc063da2..19e7591f71 100644 --- a/crates/ra_assists/Cargo.toml +++ b/crates/ra_assists/Cargo.toml @@ -19,6 +19,6 @@ syntax = { path = "../syntax" } text_edit = { path = "../text_edit" } profile = { path = "../profile" } base_db = { path = "../base_db" } -ra_ide_db = { path = "../ra_ide_db" } +ide_db = { path = "../ide_db" } hir = { path = "../hir" } test_utils = { path = "../test_utils" } diff --git a/crates/ra_assists/src/assist_context.rs b/crates/ra_assists/src/assist_context.rs index 2fdce037fb..79574b9ac8 100644 --- a/crates/ra_assists/src/assist_context.rs +++ b/crates/ra_assists/src/assist_context.rs @@ -5,7 +5,7 @@ use std::mem; use algo::find_covering_element; use base_db::{FileId, FileRange}; use hir::Semantics; -use ra_ide_db::{ +use ide_db::{ source_change::{SourceChange, SourceFileEdit}, RootDatabase, }; diff --git a/crates/ra_assists/src/handlers/add_turbo_fish.rs b/crates/ra_assists/src/handlers/add_turbo_fish.rs index 8c7ffae3dd..f4f997d8e1 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 @@ -use ra_ide_db::defs::{classify_name_ref, Definition, NameRefClass}; +use ide_db::defs::{classify_name_ref, Definition, NameRefClass}; use syntax::{ast, AstNode, SyntaxKind, T}; use test_utils::mark; diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs index e19b197d9e..cce789972e 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::{ AsAssocItem, AssocItemContainer, ModPath, Module, ModuleDef, PathResolution, Semantics, Trait, Type, }; -use ra_ide_db::{imports_locator, RootDatabase}; +use ide_db::{imports_locator, RootDatabase}; use rustc_hash::FxHashSet; use syntax::{ 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 cf34ffaf7f..f690ec343b 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 @@ use hir::{AssocItem, MacroDef, ModuleDef, Name, PathResolution, ScopeDef, SemanticsScope}; -use ra_ide_db::{ +use ide_db::{ defs::{classify_name_ref, Definition, NameRefClass}, RootDatabase, }; 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 52fbc540eb..4bcdae7ba0 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 @@ use base_db::FileId; use hir::{EnumVariant, Module, ModuleDef, Name}; -use ra_ide_db::{defs::Definition, search::Reference, RootDatabase}; +use ide_db::{defs::Definition, search::Reference, RootDatabase}; use rustc_hash::FxHashSet; use syntax::{ 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 8f66606372..3d9bdb2bf7 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 @@ use std::iter; use hir::{Adt, HasSource, ModuleDef, Semantics}; +use ide_db::RootDatabase; use itertools::Itertools; -use ra_ide_db::RootDatabase; use syntax::ast::{self, make, AstNode, MatchArm, NameOwner, Pat}; use test_utils::mark; 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 302b6b67d4..7f04b95725 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 @@ -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use syntax::ast::{self, AstNode, NameOwner}; use test_utils::mark; diff --git a/crates/ra_assists/src/handlers/inline_local_variable.rs b/crates/ra_assists/src/handlers/inline_local_variable.rs index 5315923206..2b52b333b8 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 @@ -use ra_ide_db::defs::Definition; +use ide_db::defs::Definition; use syntax::{ ast::{self, AstNode, AstToken}, TextRange, diff --git a/crates/ra_assists/src/handlers/reorder_fields.rs b/crates/ra_assists/src/handlers/reorder_fields.rs index 013720dfcb..527f457a79 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; use rustc_hash::FxHashMap; use hir::{Adt, ModuleDef, PathResolution, Semantics, Struct}; -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use syntax::{algo, ast, match_ast, AstNode, SyntaxKind, SyntaxKind::*, SyntaxNode}; use crate::{AssistContext, AssistId, AssistKind, Assists}; diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index 5d062b88b8..f0cf35caf4 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs @@ -19,7 +19,7 @@ pub mod ast_transform; use base_db::FileRange; use hir::Semantics; -use ra_ide_db::{source_change::SourceChange, RootDatabase}; +use ide_db::{source_change::SourceChange, RootDatabase}; use syntax::TextRange; 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 75d9736882..ba1fb543b8 100644 --- a/crates/ra_assists/src/tests.rs +++ b/crates/ra_assists/src/tests.rs @@ -2,7 +2,7 @@ mod generated; use base_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt}; use hir::Semantics; -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use syntax::TextRange; use test_utils::{assert_eq_text, extract_offset, extract_range}; diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs index a20453dd87..84ccacafe3 100644 --- a/crates/ra_assists/src/utils.rs +++ b/crates/ra_assists/src/utils.rs @@ -4,8 +4,8 @@ pub(crate) mod insert_use; use std::{iter, ops}; use hir::{Adt, Crate, Enum, ScopeDef, Semantics, Trait, Type}; +use ide_db::RootDatabase; use itertools::Itertools; -use ra_ide_db::RootDatabase; use rustc_hash::FxHashSet; use syntax::{ ast::{self, make, NameOwner}, diff --git a/crates/ra_ide/Cargo.toml b/crates/ra_ide/Cargo.toml index a701cdf1d5..e25aad6cfb 100644 --- a/crates/ra_ide/Cargo.toml +++ b/crates/ra_ide/Cargo.toml @@ -24,7 +24,7 @@ stdx = { path = "../stdx" } syntax = { path = "../syntax" } text_edit = { path = "../text_edit" } base_db = { path = "../base_db" } -ra_ide_db = { path = "../ra_ide_db" } +ide_db = { path = "../ide_db" } cfg = { path = "../cfg" } profile = { path = "../profile" } test_utils = { path = "../test_utils" } diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs index 3578b8d3ce..58e26b94ca 100644 --- a/crates/ra_ide/src/call_hierarchy.rs +++ b/crates/ra_ide/src/call_hierarchy.rs @@ -3,7 +3,7 @@ use indexmap::IndexMap; use hir::Semantics; -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use syntax::{ast, match_ast, AstNode, TextRange}; use crate::{ diff --git a/crates/ra_ide/src/call_info.rs b/crates/ra_ide/src/call_info.rs index 703cbc6b43..86abd2d8ce 100644 --- a/crates/ra_ide/src/call_info.rs +++ b/crates/ra_ide/src/call_info.rs @@ -1,7 +1,7 @@ //! FIXME: write short doc here use either::Either; use hir::{Docs, HirDisplay, Semantics, Type}; -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use stdx::format_to; use syntax::{ ast::{self, ArgListOwner}, diff --git a/crates/ra_ide/src/completion.rs b/crates/ra_ide/src/completion.rs index 68ac05e4ca..7fb4d687e1 100644 --- a/crates/ra_ide/src/completion.rs +++ b/crates/ra_ide/src/completion.rs @@ -19,7 +19,7 @@ mod complete_postfix; mod complete_macro_in_item_position; mod complete_trait_impl; -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use crate::{ completion::{ diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index 0e0a201d09..047ecd9d77 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs @@ -2,7 +2,7 @@ use base_db::SourceDatabase; use hir::{Semantics, SemanticsScope, Type}; -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use syntax::{ algo::{find_covering_element, find_node_at_offset}, ast, match_ast, AstNode, NodeOrToken, diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index 4e59e3a480..a3ec98178a 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs @@ -8,8 +8,8 @@ use std::cell::RefCell; use base_db::SourceDatabase; use hir::{diagnostics::DiagnosticSinkBuilder, Semantics}; +use ide_db::RootDatabase; use itertools::Itertools; -use ra_ide_db::RootDatabase; use syntax::{ ast::{self, AstNode}, 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 7e126d7a6a..85b46c9958 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::{ diagnostics::{Diagnostic, MissingFields, MissingOkInTailExpr, NoSuchField, UnresolvedModule}, HasSource, HirDisplay, Semantics, VariantDef, }; -use ra_ide_db::{ +use ide_db::{ source_change::{FileSystemEdit, SourceFileEdit}, RootDatabase, }; diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 09ec3f65e6..e771061772 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs @@ -3,7 +3,7 @@ use base_db::{FileId, SourceDatabase}; use either::Either; use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource}; -use ra_ide_db::{defs::Definition, RootDatabase}; +use ide_db::{defs::Definition, RootDatabase}; use syntax::{ ast::{self, DocCommentsOwner, NameOwner}, match_ast, AstNode, SmolStr, diff --git a/crates/ra_ide/src/expand_macro.rs b/crates/ra_ide/src/expand_macro.rs index c25e068d60..31455709d7 100644 --- a/crates/ra_ide/src/expand_macro.rs +++ b/crates/ra_ide/src/expand_macro.rs @@ -1,5 +1,5 @@ use hir::Semantics; -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use syntax::{ algo::{find_node_at_offset, SyntaxRewriter}, ast, AstNode, NodeOrToken, SyntaxKind, diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index f30df2bff4..34563a0267 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs @@ -1,7 +1,7 @@ use std::iter::successors; use hir::Semantics; -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use syntax::{ algo::{self, find_covering_element, skip_trivia_token}, ast::{self, AstNode, AstToken}, diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index b93d116bf8..15e9b7fad8 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs @@ -1,5 +1,5 @@ use hir::Semantics; -use ra_ide_db::{ +use ide_db::{ defs::{classify_name, classify_name_ref}, symbol_index, RootDatabase, }; diff --git a/crates/ra_ide/src/goto_implementation.rs b/crates/ra_ide/src/goto_implementation.rs index 6dc2ccfd05..f503f4ec5f 100644 --- a/crates/ra_ide/src/goto_implementation.rs +++ b/crates/ra_ide/src/goto_implementation.rs @@ -1,5 +1,5 @@ use hir::{Crate, ImplDef, Semantics}; -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use syntax::{algo::find_node_at_offset, ast, AstNode}; 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 8017ca58cb..4a151b1506 100644 --- a/crates/ra_ide/src/goto_type_definition.rs +++ b/crates/ra_ide/src/goto_type_definition.rs @@ -1,4 +1,4 @@ -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T}; use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index a74087f87a..331aa4db0c 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -3,11 +3,11 @@ use hir::{ Adt, AsAssocItem, AssocItemContainer, Documentation, FieldSource, HasSource, HirDisplay, Module, ModuleDef, ModuleSource, Semantics, }; -use itertools::Itertools; -use ra_ide_db::{ +use ide_db::{ defs::{classify_name, classify_name_ref, Definition}, RootDatabase, }; +use itertools::Itertools; use stdx::format_to; use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T}; use test_utils::mark; diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index 81fe274adf..002adf9159 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs @@ -1,5 +1,5 @@ use hir::{Adt, Callable, HirDisplay, Semantics, Type}; -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use stdx::to_lower_snake_case; use syntax::{ ast::{self, ArgListOwner, AstNode}, diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 0d14c823ae..66a234fff7 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs @@ -52,7 +52,7 @@ use base_db::{ CheckCanceled, Env, FileLoader, FileSet, SourceDatabase, VfsPath, }; use cfg::CfgOptions; -use ra_ide_db::{ +use ide_db::{ symbol_index::{self, FileSymbol}, LineIndexDatabase, }; @@ -86,8 +86,7 @@ pub use base_db::{ SourceRootId, }; pub use hir::{Documentation, Semantics}; -pub use ra_assists::{Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist}; -pub use ra_ide_db::{ +pub use ide_db::{ change::AnalysisChange, line_index::{LineCol, LineIndex}, search::SearchScope, @@ -95,6 +94,7 @@ pub use ra_ide_db::{ symbol_index::Query, RootDatabase, }; +pub use ra_assists::{Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist}; pub use ra_ssr::SsrError; pub use text_edit::{Indel, TextEdit}; diff --git a/crates/ra_ide/src/parent_module.rs b/crates/ra_ide/src/parent_module.rs index 8439e1d5d3..59ed2967cf 100644 --- a/crates/ra_ide/src/parent_module.rs +++ b/crates/ra_ide/src/parent_module.rs @@ -1,6 +1,6 @@ use base_db::{CrateId, FileId, FilePosition}; use hir::Semantics; -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use syntax::{ algo::find_node_at_offset, ast::{self, AstNode}, diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index e89dca869c..0a76ec6b43 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs @@ -12,7 +12,7 @@ mod rename; use hir::Semantics; -use ra_ide_db::{ +use ide_db::{ defs::{classify_name, classify_name_ref, Definition}, search::SearchScope, RootDatabase, @@ -27,7 +27,7 @@ use crate::{display::TryToNav, FilePosition, FileRange, NavigationTarget, RangeI pub(crate) use self::rename::rename; -pub use ra_ide_db::search::{Reference, ReferenceAccess, ReferenceKind}; +pub use ide_db::search::{Reference, ReferenceAccess, ReferenceKind}; #[derive(Debug, Clone)] pub struct ReferenceSearchResult { diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index 5697b9d879..d73dc9cd00 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs @@ -2,7 +2,7 @@ use base_db::SourceDatabaseExt; use hir::{Module, ModuleDef, ModuleSource, Semantics}; -use ra_ide_db::{ +use ide_db::{ defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, RootDatabase, }; diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs index fb40762cfb..c3e07c8dec 100644 --- a/crates/ra_ide/src/runnables.rs +++ b/crates/ra_ide/src/runnables.rs @@ -2,8 +2,8 @@ use std::fmt; use cfg::CfgExpr; use hir::{AsAssocItem, Attrs, HirFileId, InFile, Semantics}; +use ide_db::RootDatabase; use itertools::Itertools; -use ra_ide_db::RootDatabase; use syntax::{ ast::{self, AstNode, AttrsOwner, DocCommentsOwner, ModuleItemOwner, NameOwner}, match_ast, SyntaxNode, diff --git a/crates/ra_ide/src/ssr.rs b/crates/ra_ide/src/ssr.rs index 97b82b70e5..a8a7041923 100644 --- a/crates/ra_ide/src/ssr.rs +++ b/crates/ra_ide/src/ssr.rs @@ -1,5 +1,5 @@ use base_db::{FilePosition, FileRange}; -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use crate::SourceFileEdit; use ra_ssr::{MatchFinder, SsrError, SsrRule}; diff --git a/crates/ra_ide/src/status.rs b/crates/ra_ide/src/status.rs index 869c74accc..c237081818 100644 --- a/crates/ra_ide/src/status.rs +++ b/crates/ra_ide/src/status.rs @@ -5,11 +5,11 @@ use base_db::{ FileTextQuery, SourceRootId, }; use hir::MacroFile; -use profile::{memory_usage, Bytes}; -use ra_ide_db::{ +use ide_db::{ symbol_index::{LibrarySymbolsQuery, SymbolIndex}, RootDatabase, }; +use profile::{memory_usage, Bytes}; use rustc_hash::FxHashMap; use syntax::{ast, Parse, SyntaxNode}; diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 4b41ceb1dc..5d7c7e8d02 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -5,7 +5,7 @@ mod injection; mod tests; use hir::{Name, Semantics, VariantDef}; -use ra_ide_db::{ +use ide_db::{ defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass}, RootDatabase, }; diff --git a/crates/ra_ide/src/syntax_tree.rs b/crates/ra_ide/src/syntax_tree.rs index 17daf06b66..f800449596 100644 --- a/crates/ra_ide/src/syntax_tree.rs +++ b/crates/ra_ide/src/syntax_tree.rs @@ -1,5 +1,5 @@ use base_db::{FileId, SourceDatabase}; -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use syntax::{ algo, AstNode, NodeOrToken, SourceFile, SyntaxKind::{RAW_STRING, STRING}, diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs index 75f2a6b605..899ce5f265 100644 --- a/crates/ra_ide/src/typing.rs +++ b/crates/ra_ide/src/typing.rs @@ -16,7 +16,7 @@ mod on_enter; use base_db::{FilePosition, SourceDatabase}; -use ra_ide_db::{source_change::SourceFileEdit, RootDatabase}; +use ide_db::{source_change::SourceFileEdit, RootDatabase}; use syntax::{ algo::find_node_at_offset, 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 1939306590..f7d46146c5 100644 --- a/crates/ra_ide/src/typing/on_enter.rs +++ b/crates/ra_ide/src/typing/on_enter.rs @@ -2,7 +2,7 @@ //! comments, but should handle indent some time in the future as well. use base_db::{FilePosition, SourceDatabase}; -use ra_ide_db::RootDatabase; +use ide_db::RootDatabase; use syntax::{ ast::{self, AstToken}, AstNode, SmolStr, SourceFile, diff --git a/crates/ra_ssr/Cargo.toml b/crates/ra_ssr/Cargo.toml index bed4bbdf19..4d22a8a982 100644 --- a/crates/ra_ssr/Cargo.toml +++ b/crates/ra_ssr/Cargo.toml @@ -14,7 +14,7 @@ doctest = false text_edit = { path = "../text_edit" } syntax = { path = "../syntax" } base_db = { path = "../base_db" } -ra_ide_db = { path = "../ra_ide_db" } +ide_db = { path = "../ide_db" } hir = { path = "../hir" } rustc-hash = "1.1.0" test_utils = { path = "../test_utils" } diff --git a/crates/ra_ssr/src/lib.rs b/crates/ra_ssr/src/lib.rs index 6725582e49..b4e35107ed 100644 --- a/crates/ra_ssr/src/lib.rs +++ b/crates/ra_ssr/src/lib.rs @@ -20,7 +20,7 @@ pub use crate::matching::Match; use crate::matching::MatchFailureReason; use base_db::{FileId, FilePosition, FileRange}; use hir::Semantics; -use ra_ide_db::source_change::SourceFileEdit; +use ide_db::source_change::SourceFileEdit; use resolving::ResolvedRule; use rustc_hash::FxHashMap; use syntax::{ast, AstNode, SyntaxNode, TextRange}; @@ -49,7 +49,7 @@ pub struct SsrMatches { /// Searches a crate for pattern matches and possibly replaces them with something else. pub struct MatchFinder<'db> { /// Our source of information about the user's code. - sema: Semantics<'db, ra_ide_db::RootDatabase>, + sema: Semantics<'db, ide_db::RootDatabase>, rules: Vec, resolution_scope: resolving::ResolutionScope<'db>, restrict_ranges: Vec, @@ -59,7 +59,7 @@ impl<'db> MatchFinder<'db> { /// Constructs a new instance where names will be looked up as if they appeared at /// `lookup_context`. pub fn in_context( - db: &'db ra_ide_db::RootDatabase, + db: &'db ide_db::RootDatabase, lookup_context: FilePosition, mut restrict_ranges: Vec, ) -> MatchFinder<'db> { @@ -70,9 +70,9 @@ impl<'db> MatchFinder<'db> { } /// Constructs an instance using the start of the first file in `db` as the lookup context. - pub fn at_first_file(db: &'db ra_ide_db::RootDatabase) -> Result, SsrError> { + pub fn at_first_file(db: &'db ide_db::RootDatabase) -> Result, SsrError> { use base_db::SourceDatabaseExt; - use ra_ide_db::symbol_index::SymbolsDatabase; + use ide_db::symbol_index::SymbolsDatabase; if let Some(first_file_id) = db .local_roots() .iter() diff --git a/crates/ra_ssr/src/matching.rs b/crates/ra_ssr/src/matching.rs index e81a87c471..ffc7202ae5 100644 --- a/crates/ra_ssr/src/matching.rs +++ b/crates/ra_ssr/src/matching.rs @@ -92,7 +92,7 @@ pub(crate) fn get_match( rule: &ResolvedRule, code: &SyntaxNode, restrict_range: &Option, - sema: &Semantics, + sema: &Semantics, ) -> Result { record_match_fails_reasons_scope(debug_active, || { Matcher::try_match(rule, code, restrict_range, sema) @@ -101,7 +101,7 @@ pub(crate) fn get_match( /// Checks if our search pattern matches a particular node of the AST. struct Matcher<'db, 'sema> { - sema: &'sema Semantics<'db, ra_ide_db::RootDatabase>, + sema: &'sema Semantics<'db, ide_db::RootDatabase>, /// If any placeholders come from anywhere outside of this range, then the match will be /// rejected. restrict_range: Option, @@ -123,7 +123,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> { rule: &ResolvedRule, code: &SyntaxNode, restrict_range: &Option, - sema: &'sema Semantics<'db, ra_ide_db::RootDatabase>, + sema: &'sema Semantics<'db, ide_db::RootDatabase>, ) -> Result { let match_state = Matcher { sema, restrict_range: restrict_range.clone(), rule }; // First pass at matching, where we check that node types and idents match. @@ -606,7 +606,7 @@ impl Match { fn render_template_paths( &mut self, template: &ResolvedPattern, - sema: &Semantics, + sema: &Semantics, ) -> Result<(), MatchFailed> { let module = sema .scope(&self.matched_node) diff --git a/crates/ra_ssr/src/nester.rs b/crates/ra_ssr/src/nester.rs index 8be570d3cf..6ac355dfc2 100644 --- a/crates/ra_ssr/src/nester.rs +++ b/crates/ra_ssr/src/nester.rs @@ -13,7 +13,7 @@ use syntax::SyntaxNode; pub(crate) fn nest_and_remove_collisions( mut matches: Vec, - sema: &hir::Semantics, + sema: &hir::Semantics, ) -> SsrMatches { // We sort the matches by depth then by rule index. Sorting by depth means that by the time we // see a match, any parent matches or conflicting matches will have already been seen. Sorting @@ -36,7 +36,7 @@ impl MatchCollector { /// Attempts to add `m` to matches. If it conflicts with an existing match, it is discarded. If /// it is entirely within the a placeholder of an existing match, then it is added as a child /// match of the existing match. - fn add_match(&mut self, m: Match, sema: &hir::Semantics) { + fn add_match(&mut self, m: Match, sema: &hir::Semantics) { let matched_node = m.matched_node.clone(); if let Some(existing) = self.matches_by_node.get_mut(&matched_node) { try_add_sub_match(m, existing, sema); @@ -53,11 +53,7 @@ impl MatchCollector { } /// Attempts to add `m` as a sub-match of `existing`. -fn try_add_sub_match( - m: Match, - existing: &mut Match, - sema: &hir::Semantics, -) { +fn try_add_sub_match(m: Match, existing: &mut Match, sema: &hir::Semantics) { for p in existing.placeholder_values.values_mut() { // Note, no need to check if p.range.file is equal to m.range.file, since we // already know we're within `existing`. diff --git a/crates/ra_ssr/src/resolving.rs b/crates/ra_ssr/src/resolving.rs index dac09bae80..020fd79941 100644 --- a/crates/ra_ssr/src/resolving.rs +++ b/crates/ra_ssr/src/resolving.rs @@ -187,7 +187,7 @@ impl Resolver<'_, '_> { impl<'db> ResolutionScope<'db> { pub(crate) fn new( - sema: &hir::Semantics<'db, ra_ide_db::RootDatabase>, + sema: &hir::Semantics<'db, ide_db::RootDatabase>, resolve_context: FilePosition, ) -> ResolutionScope<'db> { use syntax::ast::AstNode; diff --git a/crates/ra_ssr/src/search.rs b/crates/ra_ssr/src/search.rs index 434953fb48..8509cfa4de 100644 --- a/crates/ra_ssr/src/search.rs +++ b/crates/ra_ssr/src/search.rs @@ -6,7 +6,7 @@ use crate::{ Match, MatchFinder, }; use base_db::{FileId, FileRange}; -use ra_ide_db::{ +use ide_db::{ defs::Definition, search::{Reference, SearchScope}, }; @@ -146,7 +146,7 @@ impl<'db> MatchFinder<'db> { if self.restrict_ranges.is_empty() { // Unrestricted search. use base_db::SourceDatabaseExt; - use ra_ide_db::symbol_index::SymbolsDatabase; + use ide_db::symbol_index::SymbolsDatabase; for &root in self.sema.db.local_roots().iter() { let sr = self.sema.db.source_root(root); for file_id in sr.iter() { diff --git a/crates/ra_ssr/src/tests.rs b/crates/ra_ssr/src/tests.rs index 54c3da9db3..0d0a000906 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() { /// `code` may optionally contain a cursor marker `<|>`. If it doesn't, then the position will be /// the start of the file. If there's a second cursor marker, then we'll return a single range. -pub(crate) fn single_file(code: &str) -> (ra_ide_db::RootDatabase, FilePosition, Vec) { +pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Vec) { use base_db::fixture::WithFixture; - use ra_ide_db::symbol_index::SymbolsDatabase; + use ide_db::symbol_index::SymbolsDatabase; let (mut db, file_id, range_or_offset) = if code.contains(test_utils::CURSOR_MARKER) { - ra_ide_db::RootDatabase::with_range_or_offset(code) + ide_db::RootDatabase::with_range_or_offset(code) } else { - let (db, file_id) = ra_ide_db::RootDatabase::with_single_file(code); + let (db, file_id) = ide_db::RootDatabase::with_single_file(code); (db, file_id, RangeOrOffset::Offset(0.into())) }; let selections; diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index c0257e9c89..da8c09c09a 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml @@ -47,7 +47,7 @@ toolchain = { path = "../toolchain" } # This should only be used in CLI base_db = { path = "../base_db" } -ra_ide_db = { path = "../ra_ide_db" } +ide_db = { path = "../ide_db" } ra_ssr = { path = "../ra_ssr" } hir = { path = "../hir" } hir_def = { path = "../hir_def" } diff --git a/crates/rust-analyzer/src/cli/ssr.rs b/crates/rust-analyzer/src/cli/ssr.rs index 08788fb415..1357a93e16 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) -> Result<()> { /// for much else. pub fn search_for_patterns(patterns: Vec, debug_snippet: Option) -> Result<()> { use base_db::SourceDatabaseExt; - use ra_ide_db::symbol_index::SymbolsDatabase; + use ide_db::symbol_index::SymbolsDatabase; let (host, _vfs) = load_cargo(&std::env::current_dir()?, true, true)?; let db = host.raw_database(); let mut match_finder = MatchFinder::at_first_file(db)?;