From 19cce08662222f012a0f50ff73afd4fdd34ca683 Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Sat, 24 Oct 2020 11:39:57 +0300 Subject: Re-export base_db from ide_db --- crates/ssr/Cargo.toml | 1 - crates/ssr/src/lib.rs | 8 ++++---- crates/ssr/src/matching.rs | 2 +- crates/ssr/src/resolving.rs | 2 +- crates/ssr/src/search.rs | 4 ++-- crates/ssr/src/tests.rs | 6 +++--- 6 files changed, 11 insertions(+), 12 deletions(-) (limited to 'crates/ssr') 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" text_edit = { path = "../text_edit", version = "0.0.0" } syntax = { path = "../syntax", version = "0.0.0" } -base_db = { path = "../base_db", version = "0.0.0" } ide_db = { path = "../ide_db", version = "0.0.0" } hir = { path = "../hir", version = "0.0.0" } 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; pub use crate::errors::SsrError; pub use crate::matching::Match; use crate::matching::MatchFailureReason; -use base_db::{FileId, FilePosition, FileRange}; use hir::Semantics; +use ide_db::base_db::{FileId, FilePosition, FileRange}; use ide_db::source_change::SourceFileEdit; use resolving::ResolvedRule; use rustc_hash::FxHashMap; @@ -126,7 +126,7 @@ 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 ide_db::RootDatabase) -> Result, SsrError> { - use base_db::SourceDatabaseExt; + use ide_db::base_db::SourceDatabaseExt; use ide_db::symbol_index::SymbolsDatabase; if let Some(first_file_id) = db .local_roots() @@ -160,7 +160,7 @@ impl<'db> MatchFinder<'db> { /// Finds matches for all added rules and returns edits for all found matches. pub fn edits(&self) -> Vec { - use base_db::SourceDatabaseExt; + use ide_db::base_db::SourceDatabaseExt; let mut matches_by_file = FxHashMap::default(); for m in self.matches().matches { matches_by_file @@ -205,7 +205,7 @@ impl<'db> MatchFinder<'db> { /// them, while recording reasons why they don't match. This API is useful for command /// line-based debugging where providing a range is difficult. pub fn debug_where_text_equal(&self, file_id: FileId, snippet: &str) -> Vec { - use base_db::SourceDatabaseExt; + use ide_db::base_db::SourceDatabaseExt; let file = self.sema.parse(file_id); let mut res = Vec::new(); 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::{ resolving::{ResolvedPattern, ResolvedRule, UfcsCallInfo}, SsrMatches, }; -use base_db::FileRange; use hir::Semantics; +use ide_db::base_db::FileRange; use rustc_hash::FxHashMap; use std::{cell::Cell, iter::Peekable}; 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 @@ use crate::errors::error; use crate::{parsing, SsrError}; -use base_db::FilePosition; +use ide_db::base_db::FilePosition; use parsing::Placeholder; use rustc_hash::FxHashMap; 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::{ resolving::{ResolvedPath, ResolvedPattern, ResolvedRule}, Match, MatchFinder, }; -use base_db::{FileId, FileRange}; +use ide_db::base_db::{FileId, FileRange}; use ide_db::{ defs::Definition, search::{Reference, SearchScope}, @@ -145,7 +145,7 @@ impl<'db> MatchFinder<'db> { fn search_files_do(&self, mut callback: impl FnMut(FileId)) { if self.restrict_ranges.is_empty() { // Unrestricted search. - use base_db::SourceDatabaseExt; + use ide_db::base_db::SourceDatabaseExt; use ide_db::symbol_index::SymbolsDatabase; for &root in self.sema.db.local_roots().iter() { 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 @@ use crate::{MatchFinder, SsrRule}; -use base_db::{salsa::Durability, FileId, FilePosition, FileRange, SourceDatabaseExt}; use expect_test::{expect, Expect}; +use ide_db::base_db::{salsa::Durability, FileId, FilePosition, FileRange, SourceDatabaseExt}; use rustc_hash::FxHashSet; use std::sync::Arc; use test_utils::{mark, RangeOrOffset}; @@ -62,7 +62,7 @@ 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) -> (ide_db::RootDatabase, FilePosition, Vec) { - use base_db::fixture::WithFixture; + use ide_db::base_db::fixture::WithFixture; use ide_db::symbol_index::SymbolsDatabase; let (mut db, file_id, range_or_offset) = if code.contains(test_utils::CURSOR_MARKER) { ide_db::RootDatabase::with_range_or_offset(code) @@ -83,7 +83,7 @@ pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Ve } } let mut local_roots = FxHashSet::default(); - local_roots.insert(base_db::fixture::WORKSPACE); + local_roots.insert(ide_db::base_db::fixture::WORKSPACE); db.set_local_roots_with_durability(Arc::new(local_roots), Durability::HIGH); (db, position, selections) } -- cgit v1.2.3