Re-export base_db from ide_db

This commit is contained in:
Igor Aleksanov 2020-10-24 11:39:57 +03:00
parent 2c787676c9
commit 19cce08662
52 changed files with 69 additions and 74 deletions

4
Cargo.lock generated
View file

@ -50,7 +50,6 @@ checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
name = "assists" name = "assists"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"base_db",
"either", "either",
"hir", "hir",
"ide_db", "ide_db",
@ -627,7 +626,6 @@ name = "ide"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"assists", "assists",
"base_db",
"cfg", "cfg",
"completion", "completion",
"either", "either",
@ -1315,7 +1313,6 @@ name = "rust-analyzer"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base_db",
"cfg", "cfg",
"crossbeam-channel 0.5.0", "crossbeam-channel 0.5.0",
"env_logger", "env_logger",
@ -1548,7 +1545,6 @@ dependencies = [
name = "ssr" name = "ssr"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"base_db",
"expect-test", "expect-test",
"hir", "hir",
"ide_db", "ide_db",

View file

@ -18,7 +18,6 @@ stdx = { path = "../stdx", version = "0.0.0" }
syntax = { path = "../syntax", version = "0.0.0" } syntax = { path = "../syntax", version = "0.0.0" }
text_edit = { path = "../text_edit", version = "0.0.0" } text_edit = { path = "../text_edit", version = "0.0.0" }
profile = { path = "../profile", version = "0.0.0" } profile = { path = "../profile", version = "0.0.0" }
base_db = { path = "../base_db", version = "0.0.0" }
ide_db = { path = "../ide_db", version = "0.0.0" } ide_db = { path = "../ide_db", version = "0.0.0" }
hir = { path = "../hir", version = "0.0.0" } hir = { path = "../hir", version = "0.0.0" }
test_utils = { path = "../test_utils", version = "0.0.0" } test_utils = { path = "../test_utils", version = "0.0.0" }

View file

@ -3,8 +3,8 @@
use std::mem; use std::mem;
use algo::find_covering_element; use algo::find_covering_element;
use base_db::{FileId, FileRange};
use hir::Semantics; use hir::Semantics;
use ide_db::base_db::{FileId, FileRange};
use ide_db::{ use ide_db::{
label::Label, label::Label,
source_change::{SourceChange, SourceFileEdit}, source_change::{SourceChange, SourceFileEdit},

View file

@ -1,5 +1,5 @@
use base_db::FileId;
use hir::{EnumVariant, Module, ModuleDef, Name}; use hir::{EnumVariant, Module, ModuleDef, Name};
use ide_db::base_db::FileId;
use ide_db::{defs::Definition, search::Reference, RootDatabase}; use ide_db::{defs::Definition, search::Reference, RootDatabase};
use itertools::Itertools; use itertools::Itertools;
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;

View file

@ -1,5 +1,5 @@
use base_db::FileId;
use hir::{db::HirDatabase, HasSource, HasVisibility, PathResolution}; use hir::{db::HirDatabase, HasSource, HasVisibility, PathResolution};
use ide_db::base_db::FileId;
use syntax::{ use syntax::{
ast::{self, VisibilityOwner}, ast::{self, VisibilityOwner},
AstNode, TextRange, TextSize, AstNode, TextRange, TextSize,

View file

@ -1,5 +1,5 @@
use base_db::FileId;
use hir::HirDisplay; use hir::HirDisplay;
use ide_db::base_db::FileId;
use rustc_hash::{FxHashMap, FxHashSet}; use rustc_hash::{FxHashMap, FxHashSet};
use syntax::{ use syntax::{
ast::{ ast::{

View file

@ -17,8 +17,8 @@ mod tests;
pub mod utils; pub mod utils;
pub mod ast_transform; pub mod ast_transform;
use base_db::FileRange;
use hir::Semantics; use hir::Semantics;
use ide_db::base_db::FileRange;
use ide_db::{label::Label, source_change::SourceChange, RootDatabase}; use ide_db::{label::Label, source_change::SourceChange, RootDatabase};
use syntax::TextRange; use syntax::TextRange;

View file

@ -1,7 +1,7 @@
mod generated; mod generated;
use base_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt};
use hir::Semantics; use hir::Semantics;
use ide_db::base_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt};
use ide_db::RootDatabase; use ide_db::RootDatabase;
use syntax::TextRange; use syntax::TextRange;
use test_utils::{assert_eq_text, extract_offset, extract_range}; use test_utils::{assert_eq_text, extract_offset, extract_range};

View file

@ -1,7 +1,7 @@
//! Completes mod declarations. //! Completes mod declarations.
use base_db::{SourceDatabaseExt, VfsPath};
use hir::{Module, ModuleSource}; use hir::{Module, ModuleSource};
use ide_db::base_db::{SourceDatabaseExt, VfsPath};
use ide_db::RootDatabase; use ide_db::RootDatabase;
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;

View file

@ -1,7 +1,7 @@
//! See `CompletionContext` structure. //! See `CompletionContext` structure.
use base_db::{FilePosition, SourceDatabase};
use hir::{Local, ScopeDef, Semantics, SemanticsScope, Type}; use hir::{Local, ScopeDef, Semantics, SemanticsScope, Type};
use ide_db::base_db::{FilePosition, SourceDatabase};
use ide_db::{call_info::ActiveParameter, RootDatabase}; use ide_db::{call_info::ActiveParameter, RootDatabase};
use syntax::{ use syntax::{
algo::{find_covering_element, find_node_at_offset}, algo::{find_covering_element, find_node_at_offset},

View file

@ -23,7 +23,7 @@ mod complete_macro_in_item_position;
mod complete_trait_impl; mod complete_trait_impl;
mod complete_mod; mod complete_mod;
use base_db::FilePosition; use ide_db::base_db::FilePosition;
use ide_db::RootDatabase; use ide_db::RootDatabase;
use crate::{ use crate::{

View file

@ -1,7 +1,7 @@
//! Runs completion for testing purposes. //! Runs completion for testing purposes.
use base_db::{fixture::ChangeFixture, FileLoader, FilePosition};
use hir::Semantics; use hir::Semantics;
use ide_db::base_db::{fixture::ChangeFixture, FileLoader, FilePosition};
use ide_db::RootDatabase; use ide_db::RootDatabase;
use itertools::Itertools; use itertools::Itertools;
use stdx::{format_to, trim_indent}; use stdx::{format_to, trim_indent};

View file

@ -23,7 +23,6 @@ url = "2.1.1"
stdx = { path = "../stdx", version = "0.0.0" } stdx = { path = "../stdx", version = "0.0.0" }
syntax = { path = "../syntax", version = "0.0.0" } syntax = { path = "../syntax", version = "0.0.0" }
text_edit = { path = "../text_edit", version = "0.0.0" } text_edit = { path = "../text_edit", version = "0.0.0" }
base_db = { path = "../base_db", version = "0.0.0" }
ide_db = { path = "../ide_db", version = "0.0.0" } ide_db = { path = "../ide_db", version = "0.0.0" }
cfg = { path = "../cfg", version = "0.0.0" } cfg = { path = "../cfg", version = "0.0.0" }
profile = { path = "../profile", version = "0.0.0" } profile = { path = "../profile", version = "0.0.0" }

View file

@ -137,7 +137,7 @@ impl CallLocations {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use base_db::FilePosition; use ide_db::base_db::FilePosition;
use crate::fixture; use crate::fixture;

View file

@ -9,11 +9,11 @@ mod field_shorthand;
use std::cell::RefCell; use std::cell::RefCell;
use base_db::SourceDatabase;
use hir::{ use hir::{
diagnostics::{Diagnostic as _, DiagnosticSinkBuilder}, diagnostics::{Diagnostic as _, DiagnosticSinkBuilder},
Semantics, Semantics,
}; };
use ide_db::base_db::SourceDatabase;
use ide_db::RootDatabase; use ide_db::RootDatabase;
use itertools::Itertools; use itertools::Itertools;
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;

View file

@ -1,7 +1,7 @@
//! Suggests shortening `Foo { field: field }` to `Foo { field }` in both //! Suggests shortening `Foo { field: field }` to `Foo { field }` in both
//! expressions and patterns. //! expressions and patterns.
use base_db::FileId; use ide_db::base_db::FileId;
use ide_db::source_change::SourceFileEdit; use ide_db::source_change::SourceFileEdit;
use syntax::{ast, match_ast, AstNode, SyntaxNode}; use syntax::{ast, match_ast, AstNode, SyntaxNode};
use text_edit::TextEdit; use text_edit::TextEdit;

View file

@ -1,6 +1,5 @@
//! Provides a way to attach fixes to the diagnostics. //! Provides a way to attach fixes to the diagnostics.
//! The same module also has all curret custom fixes for the diagnostics implemented. //! The same module also has all curret custom fixes for the diagnostics implemented.
use base_db::FileId;
use hir::{ use hir::{
db::AstDatabase, db::AstDatabase,
diagnostics::{ diagnostics::{
@ -9,6 +8,7 @@ use hir::{
}, },
HasSource, HirDisplay, Semantics, VariantDef, HasSource, HirDisplay, Semantics, VariantDef,
}; };
use ide_db::base_db::FileId;
use ide_db::{ use ide_db::{
source_change::{FileSystemEdit, SourceFileEdit}, source_change::{FileSystemEdit, SourceFileEdit},
RootDatabase, RootDatabase,

View file

@ -1,8 +1,8 @@
//! FIXME: write short doc here //! FIXME: write short doc here
use base_db::{FileId, SourceDatabase};
use either::Either; use either::Either;
use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource}; use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource};
use ide_db::base_db::{FileId, SourceDatabase};
use ide_db::{defs::Definition, RootDatabase}; use ide_db::{defs::Definition, RootDatabase};
use syntax::{ use syntax::{
ast::{self, DocCommentsOwner, NameOwner}, ast::{self, DocCommentsOwner, NameOwner},

View file

@ -1,5 +1,5 @@
//! Utilities for creating `Analysis` instances for tests. //! Utilities for creating `Analysis` instances for tests.
use base_db::fixture::ChangeFixture; use ide_db::base_db::fixture::ChangeFixture;
use test_utils::{extract_annotations, RangeOrOffset}; use test_utils::{extract_annotations, RangeOrOffset};
use crate::{Analysis, AnalysisHost, FileId, FilePosition, FileRange}; use crate::{Analysis, AnalysisHost, FileId, FilePosition, FileRange};

View file

@ -100,7 +100,7 @@ pub(crate) fn reference_definition(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use base_db::FileRange; use ide_db::base_db::FileRange;
use syntax::{TextRange, TextSize}; use syntax::{TextRange, TextSize};
use crate::fixture; use crate::fixture;

View file

@ -74,7 +74,7 @@ fn impls_for_trait(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use base_db::FileRange; use ide_db::base_db::FileRange;
use crate::fixture; use crate::fixture;

View file

@ -54,7 +54,7 @@ fn pick_best(tokens: TokenAtOffset<SyntaxToken>) -> Option<SyntaxToken> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use base_db::FileRange; use ide_db::base_db::FileRange;
use crate::fixture; use crate::fixture;

View file

@ -1,8 +1,8 @@
use base_db::SourceDatabase;
use hir::{ use hir::{
Adt, AsAssocItem, AssocItemContainer, Documentation, FieldSource, HasSource, HirDisplay, Adt, AsAssocItem, AssocItemContainer, Documentation, FieldSource, HasSource, HirDisplay,
Module, ModuleDef, ModuleSource, Semantics, Module, ModuleDef, ModuleSource, Semantics,
}; };
use ide_db::base_db::SourceDatabase;
use ide_db::{ use ide_db::{
defs::{Definition, NameClass, NameRefClass}, defs::{Definition, NameClass, NameRefClass},
RootDatabase, RootDatabase,
@ -385,8 +385,8 @@ fn pick_best(tokens: TokenAtOffset<SyntaxToken>) -> Option<SyntaxToken> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use base_db::FileLoader;
use expect_test::{expect, Expect}; use expect_test::{expect, Expect};
use ide_db::base_db::FileLoader;
use crate::fixture; use crate::fixture;

View file

@ -48,11 +48,11 @@ mod doc_links;
use std::sync::Arc; use std::sync::Arc;
use base_db::{ use cfg::CfgOptions;
use ide_db::base_db::{
salsa::{self, ParallelDatabase}, salsa::{self, ParallelDatabase},
CheckCanceled, Env, FileLoader, FileSet, SourceDatabase, VfsPath, CheckCanceled, Env, FileLoader, FileSet, SourceDatabase, VfsPath,
}; };
use cfg::CfgOptions;
use ide_db::{ use ide_db::{
symbol_index::{self, FileSymbol}, symbol_index::{self, FileSymbol},
LineIndexDatabase, LineIndexDatabase,
@ -88,11 +88,11 @@ pub use ide_db::call_info::CallInfo;
pub use assists::{ pub use assists::{
utils::MergeBehaviour, Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist, utils::MergeBehaviour, Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist,
}; };
pub use base_db::{ pub use hir::{Documentation, Semantics};
pub use ide_db::base_db::{
Canceled, Change, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRoot, Canceled, Change, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRoot,
SourceRootId, SourceRootId,
}; };
pub use hir::{Documentation, Semantics};
pub use ide_db::{ pub use ide_db::{
label::Label, label::Label,
line_index::{LineCol, LineIndex}, line_index::{LineCol, LineIndex},

View file

@ -1,5 +1,5 @@
use base_db::{CrateId, FileId, FilePosition};
use hir::Semantics; use hir::Semantics;
use ide_db::base_db::{CrateId, FileId, FilePosition};
use ide_db::RootDatabase; use ide_db::RootDatabase;
use syntax::{ use syntax::{
algo::find_node_at_offset, algo::find_node_at_offset,

View file

@ -3,8 +3,8 @@
//! request takes longer to compute. This modules implemented prepopulating of //! request takes longer to compute. This modules implemented prepopulating of
//! various caches, it's not really advanced at the moment. //! various caches, it's not really advanced at the moment.
use base_db::SourceDatabase;
use hir::db::DefDatabase; use hir::db::DefDatabase;
use ide_db::base_db::SourceDatabase;
use crate::RootDatabase; use crate::RootDatabase;

View file

@ -191,8 +191,8 @@ fn get_struct_def_name_for_struct_literal_search(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use base_db::FileId;
use expect_test::{expect, Expect}; use expect_test::{expect, Expect};
use ide_db::base_db::FileId;
use stdx::format_to; use stdx::format_to;
use crate::{fixture, SearchScope}; use crate::{fixture, SearchScope};

View file

@ -1,7 +1,7 @@
//! FIXME: write short doc here //! FIXME: write short doc here
use base_db::SourceDatabaseExt;
use hir::{Module, ModuleDef, ModuleSource, Semantics}; use hir::{Module, ModuleDef, ModuleSource, Semantics};
use ide_db::base_db::SourceDatabaseExt;
use ide_db::{ use ide_db::{
defs::{Definition, NameClass, NameRefClass}, defs::{Definition, NameClass, NameRefClass},
RootDatabase, RootDatabase,

View file

@ -1,10 +1,10 @@
use std::{fmt, iter::FromIterator, sync::Arc}; use std::{fmt, iter::FromIterator, sync::Arc};
use base_db::{ use hir::MacroFile;
use ide_db::base_db::{
salsa::debug::{DebugQueryTable, TableEntry}, salsa::debug::{DebugQueryTable, TableEntry},
CrateId, FileId, FileTextQuery, SourceDatabase, SourceRootId, CrateId, FileId, FileTextQuery, SourceDatabase, SourceRootId,
}; };
use hir::MacroFile;
use ide_db::{ use ide_db::{
symbol_index::{LibrarySymbolsQuery, SymbolIndex}, symbol_index::{LibrarySymbolsQuery, SymbolIndex},
RootDatabase, RootDatabase,
@ -16,7 +16,7 @@ use stdx::format_to;
use syntax::{ast, Parse, SyntaxNode}; use syntax::{ast, Parse, SyntaxNode};
fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats {
base_db::ParseQuery.in_db(db).entries::<SyntaxTreeStats>() ide_db::base_db::ParseQuery.in_db(db).entries::<SyntaxTreeStats>()
} }
fn macro_syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { fn macro_syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats {
hir::db::ParseMacroQuery.in_db(db).entries::<SyntaxTreeStats>() hir::db::ParseMacroQuery.in_db(db).entries::<SyntaxTreeStats>()

View file

@ -1,6 +1,6 @@
//! Renders a bit of code as HTML. //! Renders a bit of code as HTML.
use base_db::SourceDatabase; use ide_db::base_db::SourceDatabase;
use oorandom::Rand32; use oorandom::Rand32;
use stdx::format_to; use stdx::format_to;
use syntax::{AstNode, TextRange, TextSize}; use syntax::{AstNode, TextRange, TextSize};

View file

@ -1,4 +1,4 @@
use base_db::{FileId, SourceDatabase}; use ide_db::base_db::{FileId, SourceDatabase};
use ide_db::RootDatabase; use ide_db::RootDatabase;
use syntax::{ use syntax::{
algo, AstNode, NodeOrToken, SourceFile, algo, AstNode, NodeOrToken, SourceFile,

View file

@ -15,7 +15,7 @@
mod on_enter; mod on_enter;
use base_db::{FilePosition, SourceDatabase}; use ide_db::base_db::{FilePosition, SourceDatabase};
use ide_db::{source_change::SourceFileEdit, RootDatabase}; use ide_db::{source_change::SourceFileEdit, RootDatabase};
use syntax::{ use syntax::{
algo::find_node_at_offset, algo::find_node_at_offset,

View file

@ -1,7 +1,7 @@
//! Handles the `Enter` key press. At the momently, this only continues //! Handles the `Enter` key press. At the momently, this only continues
//! comments, but should handle indent some time in the future as well. //! comments, but should handle indent some time in the future as well.
use base_db::{FilePosition, SourceDatabase}; use ide_db::base_db::{FilePosition, SourceDatabase};
use ide_db::RootDatabase; use ide_db::RootDatabase;
use syntax::{ use syntax::{
ast::{self, AstToken}, ast::{self, AstToken},

View file

@ -26,6 +26,9 @@ use rustc_hash::FxHashSet;
use crate::{line_index::LineIndex, symbol_index::SymbolsDatabase}; use crate::{line_index::LineIndex, symbol_index::SymbolsDatabase};
/// `base_db` is normally also needed in places where `ide_db` is used, so this re-export is for convenience.
pub use base_db;
#[salsa::database( #[salsa::database(
base_db::SourceDatabaseStorage, base_db::SourceDatabaseStorage,
base_db::SourceDatabaseExtStorage, base_db::SourceDatabaseExtStorage,

View file

@ -46,7 +46,6 @@ cfg = { path = "../cfg", version = "0.0.0" }
toolchain = { path = "../toolchain", version = "0.0.0" } toolchain = { path = "../toolchain", version = "0.0.0" }
# This should only be used in CLI # This should only be used in CLI
base_db = { path = "../base_db", version = "0.0.0" }
ide_db = { path = "../ide_db", version = "0.0.0" } ide_db = { path = "../ide_db", version = "0.0.0" }
ssr = { path = "../ssr", version = "0.0.0" } ssr = { path = "../ssr", version = "0.0.0" }
hir = { path = "../hir", version = "0.0.0" } hir = { path = "../hir", version = "0.0.0" }

View file

@ -3,13 +3,13 @@
use std::{env, path::PathBuf, str::FromStr, sync::Arc, time::Instant}; use std::{env, path::PathBuf, str::FromStr, sync::Arc, time::Instant};
use anyhow::{bail, format_err, Result}; use anyhow::{bail, format_err, Result};
use base_db::{
salsa::{Database, Durability},
FileId,
};
use ide::{ use ide::{
Analysis, AnalysisHost, Change, CompletionConfig, DiagnosticsConfig, FilePosition, LineCol, Analysis, AnalysisHost, Change, CompletionConfig, DiagnosticsConfig, FilePosition, LineCol,
}; };
use ide_db::base_db::{
salsa::{Database, Durability},
FileId,
};
use vfs::AbsPathBuf; use vfs::AbsPathBuf;
use crate::{ use crate::{

View file

@ -6,16 +6,16 @@ use std::{
time::{SystemTime, UNIX_EPOCH}, time::{SystemTime, UNIX_EPOCH},
}; };
use base_db::{
salsa::{self, ParallelDatabase},
SourceDatabaseExt,
};
use hir::{ use hir::{
db::{AstDatabase, DefDatabase, HirDatabase}, db::{AstDatabase, DefDatabase, HirDatabase},
original_range, AssocItem, Crate, HasSource, HirDisplay, ModuleDef, original_range, AssocItem, Crate, HasSource, HirDisplay, ModuleDef,
}; };
use hir_def::FunctionId; use hir_def::FunctionId;
use hir_ty::{Ty, TypeWalk}; use hir_ty::{Ty, TypeWalk};
use ide_db::base_db::{
salsa::{self, ParallelDatabase},
SourceDatabaseExt,
};
use itertools::Itertools; use itertools::Itertools;
use oorandom::Rand32; use oorandom::Rand32;
use rayon::prelude::*; use rayon::prelude::*;

View file

@ -6,9 +6,9 @@ use std::path::Path;
use anyhow::anyhow; use anyhow::anyhow;
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;
use base_db::SourceDatabaseExt;
use hir::Crate; use hir::Crate;
use ide::{DiagnosticsConfig, Severity}; use ide::{DiagnosticsConfig, Severity};
use ide_db::base_db::SourceDatabaseExt;
use crate::cli::{load_cargo::load_cargo, Result}; use crate::cli::{load_cargo::load_cargo, Result};

View file

@ -3,9 +3,9 @@
use std::{path::Path, sync::Arc}; use std::{path::Path, sync::Arc};
use anyhow::Result; use anyhow::Result;
use base_db::CrateGraph;
use crossbeam_channel::{unbounded, Receiver}; use crossbeam_channel::{unbounded, Receiver};
use ide::{AnalysisHost, Change}; use ide::{AnalysisHost, Change};
use ide_db::base_db::CrateGraph;
use project_model::{CargoConfig, ProcMacroClient, ProjectManifest, ProjectWorkspace}; use project_model::{CargoConfig, ProcMacroClient, ProjectManifest, ProjectWorkspace};
use vfs::{loader::Handle, AbsPath, AbsPathBuf}; use vfs::{loader::Handle, AbsPath, AbsPathBuf};

View file

@ -4,7 +4,7 @@ use crate::cli::{load_cargo::load_cargo, Result};
use ssr::{MatchFinder, SsrPattern, SsrRule}; use ssr::{MatchFinder, SsrPattern, SsrRule};
pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> { pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> {
use base_db::SourceDatabaseExt; use ide_db::base_db::SourceDatabaseExt;
let (host, vfs) = load_cargo(&std::env::current_dir()?, true, true)?; let (host, vfs) = load_cargo(&std::env::current_dir()?, true, true)?;
let db = host.raw_database(); let db = host.raw_database();
let mut match_finder = MatchFinder::at_first_file(db)?; let mut match_finder = MatchFinder::at_first_file(db)?;
@ -26,7 +26,7 @@ pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> {
/// `debug_snippet`. This is intended for debugging and probably isn't in it's current form useful /// `debug_snippet`. This is intended for debugging and probably isn't in it's current form useful
/// for much else. /// for much else.
pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<String>) -> Result<()> { pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<String>) -> Result<()> {
use base_db::SourceDatabaseExt; use ide_db::base_db::SourceDatabaseExt;
use ide_db::symbol_index::SymbolsDatabase; use ide_db::symbol_index::SymbolsDatabase;
let (host, _vfs) = load_cargo(&std::env::current_dir()?, true, true)?; let (host, _vfs) = load_cargo(&std::env::current_dir()?, true, true)?;
let db = host.raw_database(); let db = host.raw_database();

View file

@ -1,8 +1,8 @@
//! Conversion lsp_types types to rust-analyzer specific ones. //! Conversion lsp_types types to rust-analyzer specific ones.
use std::convert::TryFrom; use std::convert::TryFrom;
use base_db::{FileId, FilePosition, FileRange};
use ide::{AssistKind, LineCol, LineIndex}; use ide::{AssistKind, LineCol, LineIndex};
use ide_db::base_db::{FileId, FilePosition, FileRange};
use syntax::{TextRange, TextSize}; use syntax::{TextRange, TextSize};
use vfs::AbsPathBuf; use vfs::AbsPathBuf;

View file

@ -5,10 +5,10 @@
use std::{sync::Arc, time::Instant}; use std::{sync::Arc, time::Instant};
use base_db::{CrateId, VfsPath};
use crossbeam_channel::{unbounded, Receiver, Sender}; use crossbeam_channel::{unbounded, Receiver, Sender};
use flycheck::FlycheckHandle; use flycheck::FlycheckHandle;
use ide::{Analysis, AnalysisHost, Change, FileId}; use ide::{Analysis, AnalysisHost, Change, FileId};
use ide_db::base_db::{CrateId, VfsPath};
use lsp_types::{SemanticTokens, Url}; use lsp_types::{SemanticTokens, Url};
use parking_lot::{Mutex, RwLock}; use parking_lot::{Mutex, RwLock};
use project_model::{CargoWorkspace, ProcMacroClient, ProjectWorkspace, Target}; use project_model::{CargoWorkspace, ProcMacroClient, ProjectWorkspace, Target};

View file

@ -1,8 +1,8 @@
//! Utilities for LSP-related boilerplate code. //! Utilities for LSP-related boilerplate code.
use std::{error::Error, ops::Range}; use std::{error::Error, ops::Range};
use base_db::Canceled;
use ide::LineIndex; use ide::LineIndex;
use ide_db::base_db::Canceled;
use lsp_server::Notification; use lsp_server::Notification;
use crate::{from_proto, global_state::GlobalState}; use crate::{from_proto, global_state::GlobalState};

View file

@ -5,10 +5,10 @@ use std::{
time::{Duration, Instant}, time::{Duration, Instant},
}; };
use base_db::VfsPath;
use crossbeam_channel::{select, Receiver}; use crossbeam_channel::{select, Receiver};
use ide::PrimeCachesProgress; use ide::PrimeCachesProgress;
use ide::{Canceled, FileId}; use ide::{Canceled, FileId};
use ide_db::base_db::VfsPath;
use lsp_server::{Connection, Notification, Request, Response}; use lsp_server::{Connection, Notification, Request, Response};
use lsp_types::notification::Notification as _; use lsp_types::notification::Notification as _;
use project_model::ProjectWorkspace; use project_model::ProjectWorkspace;

View file

@ -1,9 +1,9 @@
//! Project loading & configuration updates //! Project loading & configuration updates
use std::{mem, sync::Arc}; use std::{mem, sync::Arc};
use base_db::{CrateGraph, SourceRoot, VfsPath};
use flycheck::{FlycheckConfig, FlycheckHandle}; use flycheck::{FlycheckConfig, FlycheckHandle};
use ide::Change; use ide::Change;
use ide_db::base_db::{CrateGraph, SourceRoot, VfsPath};
use project_model::{ProcMacroClient, ProjectWorkspace}; use project_model::{ProcMacroClient, ProjectWorkspace};
use vfs::{file_set::FileSetConfig, AbsPath, AbsPathBuf, ChangeKind}; use vfs::{file_set::FileSetConfig, AbsPath, AbsPathBuf, ChangeKind};

View file

@ -4,13 +4,13 @@ use std::{
sync::atomic::{AtomicU32, Ordering}, sync::atomic::{AtomicU32, Ordering},
}; };
use base_db::{FileId, FileRange};
use ide::{ use ide::{
Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, Documentation, Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, Documentation,
FileSystemEdit, Fold, FoldKind, Highlight, HighlightModifier, HighlightTag, HighlightedRange, FileSystemEdit, Fold, FoldKind, Highlight, HighlightModifier, HighlightTag, HighlightedRange,
Indel, InlayHint, InlayKind, InsertTextFormat, LineIndex, Markup, NavigationTarget, Indel, InlayHint, InlayKind, InsertTextFormat, LineIndex, Markup, NavigationTarget,
ReferenceAccess, ResolvedAssist, Runnable, Severity, SourceChange, SourceFileEdit, TextEdit, ReferenceAccess, ResolvedAssist, Runnable, Severity, SourceChange, SourceFileEdit, TextEdit,
}; };
use ide_db::base_db::{FileId, FileRange};
use itertools::Itertools; use itertools::Itertools;
use syntax::{SyntaxKind, TextRange, TextSize}; use syntax::{SyntaxKind, TextRange, TextSize};
@ -809,7 +809,7 @@ mod tests {
let completions: Vec<(String, Option<String>)> = analysis let completions: Vec<(String, Option<String>)> = analysis
.completions( .completions(
&ide::CompletionConfig::default(), &ide::CompletionConfig::default(),
base_db::FilePosition { file_id, offset }, ide_db::base_db::FilePosition { file_id, offset },
) )
.unwrap() .unwrap()
.unwrap() .unwrap()

View file

@ -16,7 +16,6 @@ itertools = "0.9.0"
text_edit = { path = "../text_edit", version = "0.0.0" } text_edit = { path = "../text_edit", version = "0.0.0" }
syntax = { path = "../syntax", 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" } ide_db = { path = "../ide_db", version = "0.0.0" }
hir = { path = "../hir", version = "0.0.0" } hir = { path = "../hir", version = "0.0.0" }
test_utils = { path = "../test_utils", version = "0.0.0" } test_utils = { path = "../test_utils", version = "0.0.0" }

View file

@ -73,8 +73,8 @@ use crate::errors::bail;
pub use crate::errors::SsrError; pub use crate::errors::SsrError;
pub use crate::matching::Match; pub use crate::matching::Match;
use crate::matching::MatchFailureReason; use crate::matching::MatchFailureReason;
use base_db::{FileId, FilePosition, FileRange};
use hir::Semantics; use hir::Semantics;
use ide_db::base_db::{FileId, FilePosition, FileRange};
use ide_db::source_change::SourceFileEdit; use ide_db::source_change::SourceFileEdit;
use resolving::ResolvedRule; use resolving::ResolvedRule;
use rustc_hash::FxHashMap; 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. /// 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<MatchFinder<'db>, SsrError> { pub fn at_first_file(db: &'db ide_db::RootDatabase) -> Result<MatchFinder<'db>, SsrError> {
use base_db::SourceDatabaseExt; use ide_db::base_db::SourceDatabaseExt;
use ide_db::symbol_index::SymbolsDatabase; use ide_db::symbol_index::SymbolsDatabase;
if let Some(first_file_id) = db if let Some(first_file_id) = db
.local_roots() .local_roots()
@ -160,7 +160,7 @@ impl<'db> MatchFinder<'db> {
/// Finds matches for all added rules and returns edits for all found matches. /// Finds matches for all added rules and returns edits for all found matches.
pub fn edits(&self) -> Vec<SourceFileEdit> { pub fn edits(&self) -> Vec<SourceFileEdit> {
use base_db::SourceDatabaseExt; use ide_db::base_db::SourceDatabaseExt;
let mut matches_by_file = FxHashMap::default(); let mut matches_by_file = FxHashMap::default();
for m in self.matches().matches { for m in self.matches().matches {
matches_by_file 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 /// them, while recording reasons why they don't match. This API is useful for command
/// line-based debugging where providing a range is difficult. /// line-based debugging where providing a range is difficult.
pub fn debug_where_text_equal(&self, file_id: FileId, snippet: &str) -> Vec<MatchDebugInfo> { pub fn debug_where_text_equal(&self, file_id: FileId, snippet: &str) -> Vec<MatchDebugInfo> {
use base_db::SourceDatabaseExt; use ide_db::base_db::SourceDatabaseExt;
let file = self.sema.parse(file_id); let file = self.sema.parse(file_id);
let mut res = Vec::new(); let mut res = Vec::new();
let file_text = self.sema.db.file_text(file_id); let file_text = self.sema.db.file_text(file_id);

View file

@ -6,8 +6,8 @@ use crate::{
resolving::{ResolvedPattern, ResolvedRule, UfcsCallInfo}, resolving::{ResolvedPattern, ResolvedRule, UfcsCallInfo},
SsrMatches, SsrMatches,
}; };
use base_db::FileRange;
use hir::Semantics; use hir::Semantics;
use ide_db::base_db::FileRange;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use std::{cell::Cell, iter::Peekable}; use std::{cell::Cell, iter::Peekable};
use syntax::ast::{AstNode, AstToken}; use syntax::ast::{AstNode, AstToken};

View file

@ -2,7 +2,7 @@
use crate::errors::error; use crate::errors::error;
use crate::{parsing, SsrError}; use crate::{parsing, SsrError};
use base_db::FilePosition; use ide_db::base_db::FilePosition;
use parsing::Placeholder; use parsing::Placeholder;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use syntax::{ast, SmolStr, SyntaxKind, SyntaxNode, SyntaxToken}; use syntax::{ast, SmolStr, SyntaxKind, SyntaxNode, SyntaxToken};

View file

@ -5,7 +5,7 @@ use crate::{
resolving::{ResolvedPath, ResolvedPattern, ResolvedRule}, resolving::{ResolvedPath, ResolvedPattern, ResolvedRule},
Match, MatchFinder, Match, MatchFinder,
}; };
use base_db::{FileId, FileRange}; use ide_db::base_db::{FileId, FileRange};
use ide_db::{ use ide_db::{
defs::Definition, defs::Definition,
search::{Reference, SearchScope}, search::{Reference, SearchScope},
@ -145,7 +145,7 @@ impl<'db> MatchFinder<'db> {
fn search_files_do(&self, mut callback: impl FnMut(FileId)) { fn search_files_do(&self, mut callback: impl FnMut(FileId)) {
if self.restrict_ranges.is_empty() { if self.restrict_ranges.is_empty() {
// Unrestricted search. // Unrestricted search.
use base_db::SourceDatabaseExt; use ide_db::base_db::SourceDatabaseExt;
use ide_db::symbol_index::SymbolsDatabase; use ide_db::symbol_index::SymbolsDatabase;
for &root in self.sema.db.local_roots().iter() { for &root in self.sema.db.local_roots().iter() {
let sr = self.sema.db.source_root(root); let sr = self.sema.db.source_root(root);

View file

@ -1,6 +1,6 @@
use crate::{MatchFinder, SsrRule}; use crate::{MatchFinder, SsrRule};
use base_db::{salsa::Durability, FileId, FilePosition, FileRange, SourceDatabaseExt};
use expect_test::{expect, Expect}; use expect_test::{expect, Expect};
use ide_db::base_db::{salsa::Durability, FileId, FilePosition, FileRange, SourceDatabaseExt};
use rustc_hash::FxHashSet; use rustc_hash::FxHashSet;
use std::sync::Arc; use std::sync::Arc;
use test_utils::{mark, RangeOrOffset}; 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 /// `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. /// 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<FileRange>) { pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Vec<FileRange>) {
use base_db::fixture::WithFixture; use ide_db::base_db::fixture::WithFixture;
use 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) { let (mut db, file_id, range_or_offset) = if code.contains(test_utils::CURSOR_MARKER) {
ide_db::RootDatabase::with_range_or_offset(code) 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(); 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.set_local_roots_with_durability(Arc::new(local_roots), Durability::HIGH);
(db, position, selections) (db, position, selections)
} }