From bb5c189b7dae1ea63ccd5d7a0c2e097d7c676f77 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 13 Aug 2020 16:39:16 +0200 Subject: Rename ra_ide_db -> ide_db --- crates/ra_ssr/src/lib.rs | 10 +++++----- crates/ra_ssr/src/matching.rs | 8 ++++---- crates/ra_ssr/src/nester.rs | 10 +++------- crates/ra_ssr/src/resolving.rs | 2 +- crates/ra_ssr/src/search.rs | 4 ++-- crates/ra_ssr/src/tests.rs | 8 ++++---- 6 files changed, 19 insertions(+), 23 deletions(-) (limited to 'crates/ra_ssr/src') 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; 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 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( 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 8be570d3c..6ac355dfc 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 dac09bae8..020fd7994 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 434953fb4..8509cfa4d 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 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() { /// `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; -- cgit v1.2.3