diff options
author | Igor Aleksanov <[email protected]> | 2020-10-24 09:39:57 +0100 |
---|---|---|
committer | Igor Aleksanov <[email protected]> | 2020-10-24 09:39:57 +0100 |
commit | 19cce08662222f012a0f50ff73afd4fdd34ca683 (patch) | |
tree | 6561f9a2802caff7b5fe56eeaa0c751bc5015a91 /crates/ssr | |
parent | 2c787676c92c81a0c9efeb3e72a91c5132c8106a (diff) |
Re-export base_db from ide_db
Diffstat (limited to 'crates/ssr')
-rw-r--r-- | crates/ssr/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/ssr/src/lib.rs | 8 | ||||
-rw-r--r-- | crates/ssr/src/matching.rs | 2 | ||||
-rw-r--r-- | crates/ssr/src/resolving.rs | 2 | ||||
-rw-r--r-- | crates/ssr/src/search.rs | 4 | ||||
-rw-r--r-- | crates/ssr/src/tests.rs | 6 |
6 files changed, 11 insertions, 12 deletions
diff --git a/crates/ssr/Cargo.toml b/crates/ssr/Cargo.toml index 408140014..98ed25fb6 100644 --- a/crates/ssr/Cargo.toml +++ b/crates/ssr/Cargo.toml | |||
@@ -16,7 +16,6 @@ itertools = "0.9.0" | |||
16 | 16 | ||
17 | text_edit = { path = "../text_edit", version = "0.0.0" } | 17 | text_edit = { path = "../text_edit", version = "0.0.0" } |
18 | syntax = { path = "../syntax", version = "0.0.0" } | 18 | syntax = { path = "../syntax", version = "0.0.0" } |
19 | base_db = { path = "../base_db", version = "0.0.0" } | ||
20 | ide_db = { path = "../ide_db", version = "0.0.0" } | 19 | ide_db = { path = "../ide_db", version = "0.0.0" } |
21 | hir = { path = "../hir", version = "0.0.0" } | 20 | hir = { path = "../hir", version = "0.0.0" } |
22 | test_utils = { path = "../test_utils", version = "0.0.0" } | 21 | test_utils = { path = "../test_utils", version = "0.0.0" } |
diff --git a/crates/ssr/src/lib.rs b/crates/ssr/src/lib.rs index ba669fd56..747ce495d 100644 --- a/crates/ssr/src/lib.rs +++ b/crates/ssr/src/lib.rs | |||
@@ -73,8 +73,8 @@ use crate::errors::bail; | |||
73 | pub use crate::errors::SsrError; | 73 | pub use crate::errors::SsrError; |
74 | pub use crate::matching::Match; | 74 | pub use crate::matching::Match; |
75 | use crate::matching::MatchFailureReason; | 75 | use crate::matching::MatchFailureReason; |
76 | use base_db::{FileId, FilePosition, FileRange}; | ||
77 | use hir::Semantics; | 76 | use hir::Semantics; |
77 | use ide_db::base_db::{FileId, FilePosition, FileRange}; | ||
78 | use ide_db::source_change::SourceFileEdit; | 78 | use ide_db::source_change::SourceFileEdit; |
79 | use resolving::ResolvedRule; | 79 | use resolving::ResolvedRule; |
80 | use rustc_hash::FxHashMap; | 80 | use rustc_hash::FxHashMap; |
@@ -126,7 +126,7 @@ impl<'db> MatchFinder<'db> { | |||
126 | 126 | ||
127 | /// Constructs an instance using the start of the first file in `db` as the lookup context. | 127 | /// Constructs an instance using the start of the first file in `db` as the lookup context. |
128 | pub fn at_first_file(db: &'db ide_db::RootDatabase) -> Result<MatchFinder<'db>, SsrError> { | 128 | pub fn at_first_file(db: &'db ide_db::RootDatabase) -> Result<MatchFinder<'db>, SsrError> { |
129 | use base_db::SourceDatabaseExt; | 129 | use ide_db::base_db::SourceDatabaseExt; |
130 | use ide_db::symbol_index::SymbolsDatabase; | 130 | use ide_db::symbol_index::SymbolsDatabase; |
131 | if let Some(first_file_id) = db | 131 | if let Some(first_file_id) = db |
132 | .local_roots() | 132 | .local_roots() |
@@ -160,7 +160,7 @@ impl<'db> MatchFinder<'db> { | |||
160 | 160 | ||
161 | /// Finds matches for all added rules and returns edits for all found matches. | 161 | /// Finds matches for all added rules and returns edits for all found matches. |
162 | pub fn edits(&self) -> Vec<SourceFileEdit> { | 162 | pub fn edits(&self) -> Vec<SourceFileEdit> { |
163 | use base_db::SourceDatabaseExt; | 163 | use ide_db::base_db::SourceDatabaseExt; |
164 | let mut matches_by_file = FxHashMap::default(); | 164 | let mut matches_by_file = FxHashMap::default(); |
165 | for m in self.matches().matches { | 165 | for m in self.matches().matches { |
166 | matches_by_file | 166 | matches_by_file |
@@ -205,7 +205,7 @@ impl<'db> MatchFinder<'db> { | |||
205 | /// them, while recording reasons why they don't match. This API is useful for command | 205 | /// them, while recording reasons why they don't match. This API is useful for command |
206 | /// line-based debugging where providing a range is difficult. | 206 | /// line-based debugging where providing a range is difficult. |
207 | pub fn debug_where_text_equal(&self, file_id: FileId, snippet: &str) -> Vec<MatchDebugInfo> { | 207 | pub fn debug_where_text_equal(&self, file_id: FileId, snippet: &str) -> Vec<MatchDebugInfo> { |
208 | use base_db::SourceDatabaseExt; | 208 | use ide_db::base_db::SourceDatabaseExt; |
209 | let file = self.sema.parse(file_id); | 209 | let file = self.sema.parse(file_id); |
210 | let mut res = Vec::new(); | 210 | let mut res = Vec::new(); |
211 | let file_text = self.sema.db.file_text(file_id); | 211 | let file_text = self.sema.db.file_text(file_id); |
diff --git a/crates/ssr/src/matching.rs b/crates/ssr/src/matching.rs index 948862a77..99b187311 100644 --- a/crates/ssr/src/matching.rs +++ b/crates/ssr/src/matching.rs | |||
@@ -6,8 +6,8 @@ use crate::{ | |||
6 | resolving::{ResolvedPattern, ResolvedRule, UfcsCallInfo}, | 6 | resolving::{ResolvedPattern, ResolvedRule, UfcsCallInfo}, |
7 | SsrMatches, | 7 | SsrMatches, |
8 | }; | 8 | }; |
9 | use base_db::FileRange; | ||
10 | use hir::Semantics; | 9 | use hir::Semantics; |
10 | use ide_db::base_db::FileRange; | ||
11 | use rustc_hash::FxHashMap; | 11 | use rustc_hash::FxHashMap; |
12 | use std::{cell::Cell, iter::Peekable}; | 12 | use std::{cell::Cell, iter::Peekable}; |
13 | use syntax::ast::{AstNode, AstToken}; | 13 | use syntax::ast::{AstNode, AstToken}; |
diff --git a/crates/ssr/src/resolving.rs b/crates/ssr/src/resolving.rs index 347cc4aad..f5ceb5729 100644 --- a/crates/ssr/src/resolving.rs +++ b/crates/ssr/src/resolving.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use crate::errors::error; | 3 | use crate::errors::error; |
4 | use crate::{parsing, SsrError}; | 4 | use crate::{parsing, SsrError}; |
5 | use base_db::FilePosition; | 5 | use ide_db::base_db::FilePosition; |
6 | use parsing::Placeholder; | 6 | use parsing::Placeholder; |
7 | use rustc_hash::FxHashMap; | 7 | use rustc_hash::FxHashMap; |
8 | use syntax::{ast, SmolStr, SyntaxKind, SyntaxNode, SyntaxToken}; | 8 | use syntax::{ast, SmolStr, SyntaxKind, SyntaxNode, SyntaxToken}; |
diff --git a/crates/ssr/src/search.rs b/crates/ssr/src/search.rs index a595fd269..44b5db029 100644 --- a/crates/ssr/src/search.rs +++ b/crates/ssr/src/search.rs | |||
@@ -5,7 +5,7 @@ use crate::{ | |||
5 | resolving::{ResolvedPath, ResolvedPattern, ResolvedRule}, | 5 | resolving::{ResolvedPath, ResolvedPattern, ResolvedRule}, |
6 | Match, MatchFinder, | 6 | Match, MatchFinder, |
7 | }; | 7 | }; |
8 | use base_db::{FileId, FileRange}; | 8 | use ide_db::base_db::{FileId, FileRange}; |
9 | use ide_db::{ | 9 | use ide_db::{ |
10 | defs::Definition, | 10 | defs::Definition, |
11 | search::{Reference, SearchScope}, | 11 | search::{Reference, SearchScope}, |
@@ -145,7 +145,7 @@ impl<'db> MatchFinder<'db> { | |||
145 | fn search_files_do(&self, mut callback: impl FnMut(FileId)) { | 145 | fn search_files_do(&self, mut callback: impl FnMut(FileId)) { |
146 | if self.restrict_ranges.is_empty() { | 146 | if self.restrict_ranges.is_empty() { |
147 | // Unrestricted search. | 147 | // Unrestricted search. |
148 | use base_db::SourceDatabaseExt; | 148 | use ide_db::base_db::SourceDatabaseExt; |
149 | use ide_db::symbol_index::SymbolsDatabase; | 149 | use ide_db::symbol_index::SymbolsDatabase; |
150 | for &root in self.sema.db.local_roots().iter() { | 150 | for &root in self.sema.db.local_roots().iter() { |
151 | let sr = self.sema.db.source_root(root); | 151 | let sr = self.sema.db.source_root(root); |
diff --git a/crates/ssr/src/tests.rs b/crates/ssr/src/tests.rs index 20231a9bc..63131f6ca 100644 --- a/crates/ssr/src/tests.rs +++ b/crates/ssr/src/tests.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use crate::{MatchFinder, SsrRule}; | 1 | use crate::{MatchFinder, SsrRule}; |
2 | use base_db::{salsa::Durability, FileId, FilePosition, FileRange, SourceDatabaseExt}; | ||
3 | use expect_test::{expect, Expect}; | 2 | use expect_test::{expect, Expect}; |
3 | use ide_db::base_db::{salsa::Durability, FileId, FilePosition, FileRange, SourceDatabaseExt}; | ||
4 | use rustc_hash::FxHashSet; | 4 | use rustc_hash::FxHashSet; |
5 | use std::sync::Arc; | 5 | use std::sync::Arc; |
6 | use test_utils::{mark, RangeOrOffset}; | 6 | use test_utils::{mark, RangeOrOffset}; |
@@ -62,7 +62,7 @@ fn parser_undefined_placeholder_in_replacement() { | |||
62 | /// `code` may optionally contain a cursor marker `<|>`. If it doesn't, then the position will be | 62 | /// `code` may optionally contain a cursor marker `<|>`. If it doesn't, then the position will be |
63 | /// the start of the file. If there's a second cursor marker, then we'll return a single range. | 63 | /// the start of the file. If there's a second cursor marker, then we'll return a single range. |
64 | pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Vec<FileRange>) { | 64 | pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Vec<FileRange>) { |
65 | use base_db::fixture::WithFixture; | 65 | use ide_db::base_db::fixture::WithFixture; |
66 | use ide_db::symbol_index::SymbolsDatabase; | 66 | use ide_db::symbol_index::SymbolsDatabase; |
67 | let (mut db, file_id, range_or_offset) = if code.contains(test_utils::CURSOR_MARKER) { | 67 | let (mut db, file_id, range_or_offset) = if code.contains(test_utils::CURSOR_MARKER) { |
68 | ide_db::RootDatabase::with_range_or_offset(code) | 68 | ide_db::RootDatabase::with_range_or_offset(code) |
@@ -83,7 +83,7 @@ pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Ve | |||
83 | } | 83 | } |
84 | } | 84 | } |
85 | let mut local_roots = FxHashSet::default(); | 85 | let mut local_roots = FxHashSet::default(); |
86 | local_roots.insert(base_db::fixture::WORKSPACE); | 86 | local_roots.insert(ide_db::base_db::fixture::WORKSPACE); |
87 | db.set_local_roots_with_durability(Arc::new(local_roots), Durability::HIGH); | 87 | db.set_local_roots_with_durability(Arc::new(local_roots), Durability::HIGH); |
88 | (db, position, selections) | 88 | (db, position, selections) |
89 | } | 89 | } |