From be1a005ebd02298feb8d272278354411d16acdee Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 26 Jan 2019 11:09:39 +0300 Subject: fold syntax database into files database --- crates/ra_db/src/lib.rs | 13 +++++-------- crates/ra_hir/src/db.rs | 4 ++-- crates/ra_hir/src/mock.rs | 10 +++------- crates/ra_hir/src/ty/tests.rs | 2 +- crates/ra_ide_api/src/call_info.rs | 2 +- crates/ra_ide_api/src/completion.rs | 2 +- crates/ra_ide_api/src/db.rs | 7 +++---- crates/ra_ide_api/src/extend_selection.rs | 2 +- crates/ra_ide_api/src/goto_definition.rs | 2 +- crates/ra_ide_api/src/hover.rs | 2 +- crates/ra_ide_api/src/imp.rs | 2 +- crates/ra_ide_api/src/lib.rs | 2 +- crates/ra_ide_api/src/rename.rs | 2 +- crates/ra_ide_api/src/runnables.rs | 2 +- crates/ra_ide_api/src/syntax_highlighting.rs | 2 +- 15 files changed, 24 insertions(+), 32 deletions(-) (limited to 'crates') diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index 3a0aa7d24..4bfc3f9ae 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs @@ -20,7 +20,7 @@ pub use crate::{ loc2id::LocationIntener, }; -pub trait BaseDatabase: salsa::Database + panic::RefUnwindSafe { +pub trait CheckCanceled: salsa::Database + panic::RefUnwindSafe { /// Aborts current query if there are pending changes. /// /// rust-analyzer needs to be able to answer semantic questions about the @@ -64,10 +64,12 @@ pub struct FileRange { } #[salsa::query_group(FilesDatabaseStorage)] -pub trait FilesDatabase: salsa::Database { +pub trait FilesDatabase: salsa::Database + CheckCanceled { /// Text of the file. #[salsa::input] fn file_text(&self, file_id: FileId) -> Arc; + // Parses the file into the syntax tree. + fn source_file(&self, file_id: FileId) -> TreeArc; /// Path to a file, relative to the root of its source root. #[salsa::input] fn file_relative_path(&self, file_id: FileId) -> RelativePathBuf; @@ -102,12 +104,7 @@ fn source_root_crates(db: &impl FilesDatabase, id: SourceRootId) -> Arc TreeArc; -} - -fn source_file(db: &impl SyntaxDatabase, file_id: FileId) -> TreeArc { +fn source_file(db: &impl FilesDatabase, file_id: FileId) -> TreeArc { let text = db.file_text(file_id); SourceFile::parse(&*text) } diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index dfbf41bd6..1bb9e0305 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use ra_syntax::{SyntaxNode, TreeArc, SourceFile}; -use ra_db::{SyntaxDatabase, CrateId, salsa}; +use ra_db::{FilesDatabase, CrateId, salsa}; use crate::{ MacroCallId, HirFileId, @@ -19,7 +19,7 @@ use crate::{ }; #[salsa::query_group(HirDatabaseStorage)] -pub trait HirDatabase: SyntaxDatabase + AsRef { +pub trait HirDatabase: FilesDatabase + AsRef { #[salsa::invoke(HirFileId::hir_source_file)] fn hir_source_file(&self, file_id: HirFileId) -> TreeArc; diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs index 2dc252b1e..4af4dd096 100644 --- a/crates/ra_hir/src/mock.rs +++ b/crates/ra_hir/src/mock.rs @@ -2,7 +2,7 @@ use std::{sync::Arc, panic}; use parking_lot::Mutex; use ra_db::{ - BaseDatabase, FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId, FilesDatabase, salsa, + CheckCanceled, FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId, FilesDatabase, salsa, }; use relative_path::RelativePathBuf; use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset}; @@ -11,11 +11,7 @@ use crate::{db, HirInterner}; pub const WORKSPACE: SourceRootId = SourceRootId(0); -#[salsa::database( - ra_db::FilesDatabaseStorage, - ra_db::SyntaxDatabaseStorage, - db::HirDatabaseStorage -)] +#[salsa::database(ra_db::FilesDatabaseStorage, db::HirDatabaseStorage)] #[derive(Debug)] pub(crate) struct MockDatabase { events: Mutex>>>, @@ -161,7 +157,7 @@ impl salsa::ParallelDatabase for MockDatabase { } } -impl BaseDatabase for MockDatabase {} +impl CheckCanceled for MockDatabase {} impl AsRef for MockDatabase { fn as_ref(&self) -> &HirInterner { diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 389bdaf23..a56783b6e 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use std::fmt::Write; -use ra_db::{SyntaxDatabase, salsa::Database}; +use ra_db::{FilesDatabase, salsa::Database}; use ra_syntax::ast::{self, AstNode}; use crate::{ diff --git a/crates/ra_ide_api/src/call_info.rs b/crates/ra_ide_api/src/call_info.rs index 0449c1902..0eb70df16 100644 --- a/crates/ra_ide_api/src/call_info.rs +++ b/crates/ra_ide_api/src/call_info.rs @@ -1,4 +1,4 @@ -use ra_db::SyntaxDatabase; +use ra_db::FilesDatabase; use ra_syntax::{ AstNode, SyntaxNode, TextUnit, TextRange, SyntaxKind::FN_DEF, diff --git a/crates/ra_ide_api/src/completion.rs b/crates/ra_ide_api/src/completion.rs index 565d57c37..581ba5de8 100644 --- a/crates/ra_ide_api/src/completion.rs +++ b/crates/ra_ide_api/src/completion.rs @@ -9,7 +9,7 @@ mod complete_path; mod complete_scope; mod complete_postfix; -use ra_db::SyntaxDatabase; +use ra_db::FilesDatabase; use crate::{ db, diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs index 30891aed4..02e12437c 100644 --- a/crates/ra_ide_api/src/db.rs +++ b/crates/ra_ide_api/src/db.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use ra_db::{ - BaseDatabase, FileId, Canceled, + CheckCanceled, FileId, Canceled, salsa::{self, Database}, }; @@ -9,7 +9,6 @@ use crate::{symbol_index, LineIndex}; #[salsa::database( ra_db::FilesDatabaseStorage, - ra_db::SyntaxDatabaseStorage, LineIndexDatabaseStorage, symbol_index::SymbolsDatabaseStorage, hir::db::HirDatabaseStorage @@ -54,7 +53,7 @@ impl salsa::ParallelDatabase for RootDatabase { } } -impl BaseDatabase for RootDatabase {} +impl CheckCanceled for RootDatabase {} impl AsRef for RootDatabase { fn as_ref(&self) -> &hir::HirInterner { @@ -63,7 +62,7 @@ impl AsRef for RootDatabase { } #[salsa::query_group(LineIndexDatabaseStorage)] -pub(crate) trait LineIndexDatabase: ra_db::FilesDatabase + BaseDatabase { +pub(crate) trait LineIndexDatabase: ra_db::FilesDatabase + CheckCanceled { fn line_index(&self, file_id: FileId) -> Arc; } diff --git a/crates/ra_ide_api/src/extend_selection.rs b/crates/ra_ide_api/src/extend_selection.rs index 718b4def5..bc19b0b9d 100644 --- a/crates/ra_ide_api/src/extend_selection.rs +++ b/crates/ra_ide_api/src/extend_selection.rs @@ -1,4 +1,4 @@ -use ra_db::SyntaxDatabase; +use ra_db::FilesDatabase; use ra_syntax::{ SyntaxNode, AstNode, SourceFile, ast, algo::find_covering_node, diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index dc0c50918..0e40e35ce 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs @@ -1,4 +1,4 @@ -use ra_db::{FileId, SyntaxDatabase}; +use ra_db::{FileId, FilesDatabase}; use ra_syntax::{ AstNode, ast, algo::find_node_at_offset, diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index 4d4bfbc4d..04f5a746e 100644 --- a/crates/ra_ide_api/src/hover.rs +++ b/crates/ra_ide_api/src/hover.rs @@ -1,4 +1,4 @@ -use ra_db::{SyntaxDatabase}; +use ra_db::FilesDatabase; use ra_syntax::{ AstNode, SyntaxNode, TreeArc, ast, algo::{find_covering_node, find_node_at_offset, find_leaf_at_offset, visit::{visitor, Visitor}}, diff --git a/crates/ra_ide_api/src/imp.rs b/crates/ra_ide_api/src/imp.rs index bd9e3f1e3..f2d41321d 100644 --- a/crates/ra_ide_api/src/imp.rs +++ b/crates/ra_ide_api/src/imp.rs @@ -4,7 +4,7 @@ use hir::{ self, Problem, source_binder }; use ra_db::{ - FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase, + FilesDatabase, SourceRoot, SourceRootId, salsa::{Database, SweepStrategy}, }; use ra_ide_api_light::{self, assists, LocalEdit, Severity}; diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index ffd026b04..8380aa6c2 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs @@ -34,7 +34,7 @@ use std::{fmt, sync::Arc}; use ra_syntax::{SourceFile, TreeArc, TextRange, TextUnit}; use ra_text_edit::TextEdit; use ra_db::{ - SyntaxDatabase, FilesDatabase, BaseDatabase, + FilesDatabase, CheckCanceled, salsa::{self, ParallelDatabase}, }; use rayon::prelude::*; diff --git a/crates/ra_ide_api/src/rename.rs b/crates/ra_ide_api/src/rename.rs index 5b767addd..fe81609df 100644 --- a/crates/ra_ide_api/src/rename.rs +++ b/crates/ra_ide_api/src/rename.rs @@ -17,7 +17,7 @@ use crate::{ SourceChange, SourceFileEdit, }; -use ra_db::{FilesDatabase, SyntaxDatabase}; +use ra_db::FilesDatabase; use relative_path::RelativePath; pub(crate) fn rename( diff --git a/crates/ra_ide_api/src/runnables.rs b/crates/ra_ide_api/src/runnables.rs index 0f9f8deb3..e21724207 100644 --- a/crates/ra_ide_api/src/runnables.rs +++ b/crates/ra_ide_api/src/runnables.rs @@ -3,7 +3,7 @@ use ra_syntax::{ TextRange, SyntaxNode, ast::{self, AstNode, NameOwner, ModuleItemOwner}, }; -use ra_db::SyntaxDatabase; +use ra_db::FilesDatabase; use crate::{db::RootDatabase, FileId}; diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs index a4d3ad005..cfa0257dd 100644 --- a/crates/ra_ide_api/src/syntax_highlighting.rs +++ b/crates/ra_ide_api/src/syntax_highlighting.rs @@ -1,5 +1,5 @@ use ra_syntax::{ast, AstNode,}; -use ra_db::SyntaxDatabase; +use ra_db::FilesDatabase; use crate::{ FileId, HighlightedRange, -- cgit v1.2.3 From 3223de59765cae816099e8684a2caf13bc69bb2e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 26 Jan 2019 11:17:05 +0300 Subject: move ide queries to ide db --- crates/ra_db/src/lib.rs | 8 -------- crates/ra_hir/src/mock.rs | 2 -- crates/ra_ide_api/src/db.rs | 15 ++++++--------- crates/ra_ide_api/src/symbol_index.rs | 8 ++++++++ 4 files changed, 14 insertions(+), 19 deletions(-) (limited to 'crates') diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index 4bfc3f9ae..cab47dcac 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs @@ -80,14 +80,6 @@ pub trait FilesDatabase: salsa::Database + CheckCanceled { #[salsa::input] fn source_root(&self, id: SourceRootId) -> Arc; fn source_root_crates(&self, id: SourceRootId) -> Arc>; - /// The set of "local" (that is, from the current workspace) roots. - /// Files in local roots are assumed to change frequently. - #[salsa::input] - fn local_roots(&self) -> Arc>; - /// The set of roots for crates.io libraries. - /// Files in libraries are assumed to never change. - #[salsa::input] - fn library_roots(&self) -> Arc>; /// The crate graph. #[salsa::input] fn crate_graph(&self) -> Arc; diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs index 4af4dd096..cfbe652b0 100644 --- a/crates/ra_hir/src/mock.rs +++ b/crates/ra_hir/src/mock.rs @@ -140,8 +140,6 @@ impl Default for MockDatabase { file_counter: 0, }; db.set_crate_graph(Default::default()); - db.set_local_roots(Default::default()); - db.set_library_roots(Default::default()); db } } diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs index 02e12437c..119190e0a 100644 --- a/crates/ra_ide_api/src/db.rs +++ b/crates/ra_ide_api/src/db.rs @@ -1,11 +1,11 @@ use std::sync::Arc; use ra_db::{ - CheckCanceled, FileId, Canceled, - salsa::{self, Database}, + CheckCanceled, FileId, Canceled, FilesDatabase, + salsa, }; -use crate::{symbol_index, LineIndex}; +use crate::{LineIndex, symbol_index::{self, SymbolsDatabase}}; #[salsa::database( ra_db::FilesDatabaseStorage, @@ -34,12 +34,9 @@ impl Default for RootDatabase { runtime: salsa::Runtime::default(), interner: Default::default(), }; - db.query_mut(ra_db::CrateGraphQuery) - .set((), Default::default()); - db.query_mut(ra_db::LocalRootsQuery) - .set((), Default::default()); - db.query_mut(ra_db::LibraryRootsQuery) - .set((), Default::default()); + db.set_crate_graph(Default::default()); + db.set_local_roots(Default::default()); + db.set_library_roots(Default::default()); db } } diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs index e073a349e..4d81d14b3 100644 --- a/crates/ra_ide_api/src/symbol_index.rs +++ b/crates/ra_ide_api/src/symbol_index.rs @@ -49,6 +49,14 @@ pub(crate) trait SymbolsDatabase: hir::db::HirDatabase { fn file_symbols(&self, file_id: FileId) -> Arc; #[salsa::input] fn library_symbols(&self, id: SourceRootId) -> Arc; + /// The set of "local" (that is, from the current workspace) roots. + /// Files in local roots are assumed to change frequently. + #[salsa::input] + fn local_roots(&self) -> Arc>; + /// The set of roots for crates.io libraries. + /// Files in libraries are assumed to never change. + #[salsa::input] + fn library_roots(&self) -> Arc>; } fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Arc { -- cgit v1.2.3 From 4711cbcace33e34d43f880d30c2778c843240f27 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 26 Jan 2019 11:20:30 +0300 Subject: rename FilesDatabase -> SourceDatabase --- crates/ra_db/src/lib.rs | 10 ++++++---- crates/ra_hir/src/db.rs | 4 ++-- crates/ra_hir/src/mock.rs | 4 ++-- crates/ra_hir/src/nameres/tests.rs | 2 +- crates/ra_hir/src/ty/tests.rs | 2 +- crates/ra_ide_api/src/call_info.rs | 2 +- crates/ra_ide_api/src/completion.rs | 2 +- crates/ra_ide_api/src/db.rs | 8 ++++---- crates/ra_ide_api/src/extend_selection.rs | 2 +- crates/ra_ide_api/src/goto_definition.rs | 2 +- crates/ra_ide_api/src/hover.rs | 2 +- crates/ra_ide_api/src/imp.rs | 2 +- crates/ra_ide_api/src/lib.rs | 2 +- crates/ra_ide_api/src/rename.rs | 2 +- crates/ra_ide_api/src/runnables.rs | 2 +- crates/ra_ide_api/src/symbol_index.rs | 2 +- crates/ra_ide_api/src/syntax_highlighting.rs | 2 +- 17 files changed, 27 insertions(+), 25 deletions(-) (limited to 'crates') diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index cab47dcac..2664dc69a 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs @@ -63,8 +63,10 @@ pub struct FileRange { pub range: TextRange, } -#[salsa::query_group(FilesDatabaseStorage)] -pub trait FilesDatabase: salsa::Database + CheckCanceled { +/// Database which stores all significant input facts: source code and project +/// model. Everything else in rust-analyzer is derived from these queries. +#[salsa::query_group(SourceDatabaseStorage)] +pub trait SourceDatabase: salsa::Database + CheckCanceled { /// Text of the file. #[salsa::input] fn file_text(&self, file_id: FileId) -> Arc; @@ -85,7 +87,7 @@ pub trait FilesDatabase: salsa::Database + CheckCanceled { fn crate_graph(&self) -> Arc; } -fn source_root_crates(db: &impl FilesDatabase, id: SourceRootId) -> Arc> { +fn source_root_crates(db: &impl SourceDatabase, id: SourceRootId) -> Arc> { let root = db.source_root(id); let graph = db.crate_graph(); let res = root @@ -96,7 +98,7 @@ fn source_root_crates(db: &impl FilesDatabase, id: SourceRootId) -> Arc TreeArc { +fn source_file(db: &impl SourceDatabase, file_id: FileId) -> TreeArc { let text = db.file_text(file_id); SourceFile::parse(&*text) } diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index 1bb9e0305..9b5b79d38 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use ra_syntax::{SyntaxNode, TreeArc, SourceFile}; -use ra_db::{FilesDatabase, CrateId, salsa}; +use ra_db::{SourceDatabase, CrateId, salsa}; use crate::{ MacroCallId, HirFileId, @@ -19,7 +19,7 @@ use crate::{ }; #[salsa::query_group(HirDatabaseStorage)] -pub trait HirDatabase: FilesDatabase + AsRef { +pub trait HirDatabase: SourceDatabase + AsRef { #[salsa::invoke(HirFileId::hir_source_file)] fn hir_source_file(&self, file_id: HirFileId) -> TreeArc; diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs index cfbe652b0..7da15eca0 100644 --- a/crates/ra_hir/src/mock.rs +++ b/crates/ra_hir/src/mock.rs @@ -2,7 +2,7 @@ use std::{sync::Arc, panic}; use parking_lot::Mutex; use ra_db::{ - CheckCanceled, FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId, FilesDatabase, salsa, + CheckCanceled, FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId, SourceDatabase, salsa, }; use relative_path::RelativePathBuf; use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset}; @@ -11,7 +11,7 @@ use crate::{db, HirInterner}; pub const WORKSPACE: SourceRootId = SourceRootId(0); -#[salsa::database(ra_db::FilesDatabaseStorage, db::HirDatabaseStorage)] +#[salsa::database(ra_db::SourceDatabaseStorage, db::HirDatabaseStorage)] #[derive(Debug)] pub(crate) struct MockDatabase { events: Mutex>>>, diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index 24936976c..e72781f51 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use ra_db::{CrateGraph, SourceRootId, FilesDatabase}; +use ra_db::{CrateGraph, SourceRootId, SourceDatabase}; use relative_path::RelativePath; use test_utils::{assert_eq_text, covers}; diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index a56783b6e..0eb4da06e 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use std::fmt::Write; -use ra_db::{FilesDatabase, salsa::Database}; +use ra_db::{SourceDatabase, salsa::Database}; use ra_syntax::ast::{self, AstNode}; use crate::{ diff --git a/crates/ra_ide_api/src/call_info.rs b/crates/ra_ide_api/src/call_info.rs index 0eb70df16..728f2df30 100644 --- a/crates/ra_ide_api/src/call_info.rs +++ b/crates/ra_ide_api/src/call_info.rs @@ -1,4 +1,4 @@ -use ra_db::FilesDatabase; +use ra_db::SourceDatabase; use ra_syntax::{ AstNode, SyntaxNode, TextUnit, TextRange, SyntaxKind::FN_DEF, diff --git a/crates/ra_ide_api/src/completion.rs b/crates/ra_ide_api/src/completion.rs index 581ba5de8..be64f2c5a 100644 --- a/crates/ra_ide_api/src/completion.rs +++ b/crates/ra_ide_api/src/completion.rs @@ -9,7 +9,7 @@ mod complete_path; mod complete_scope; mod complete_postfix; -use ra_db::FilesDatabase; +use ra_db::SourceDatabase; use crate::{ db, diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs index 119190e0a..3da93ec35 100644 --- a/crates/ra_ide_api/src/db.rs +++ b/crates/ra_ide_api/src/db.rs @@ -1,14 +1,14 @@ use std::sync::Arc; use ra_db::{ - CheckCanceled, FileId, Canceled, FilesDatabase, + CheckCanceled, FileId, Canceled, SourceDatabase, salsa, }; use crate::{LineIndex, symbol_index::{self, SymbolsDatabase}}; #[salsa::database( - ra_db::FilesDatabaseStorage, + ra_db::SourceDatabaseStorage, LineIndexDatabaseStorage, symbol_index::SymbolsDatabaseStorage, hir::db::HirDatabaseStorage @@ -59,11 +59,11 @@ impl AsRef for RootDatabase { } #[salsa::query_group(LineIndexDatabaseStorage)] -pub(crate) trait LineIndexDatabase: ra_db::FilesDatabase + CheckCanceled { +pub(crate) trait LineIndexDatabase: ra_db::SourceDatabase + CheckCanceled { fn line_index(&self, file_id: FileId) -> Arc; } -fn line_index(db: &impl ra_db::FilesDatabase, file_id: FileId) -> Arc { +fn line_index(db: &impl ra_db::SourceDatabase, file_id: FileId) -> Arc { let text = db.file_text(file_id); Arc::new(LineIndex::new(&*text)) } diff --git a/crates/ra_ide_api/src/extend_selection.rs b/crates/ra_ide_api/src/extend_selection.rs index bc19b0b9d..1cd955357 100644 --- a/crates/ra_ide_api/src/extend_selection.rs +++ b/crates/ra_ide_api/src/extend_selection.rs @@ -1,4 +1,4 @@ -use ra_db::FilesDatabase; +use ra_db::SourceDatabase; use ra_syntax::{ SyntaxNode, AstNode, SourceFile, ast, algo::find_covering_node, diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index 0e40e35ce..180cc7c80 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs @@ -1,4 +1,4 @@ -use ra_db::{FileId, FilesDatabase}; +use ra_db::{FileId, SourceDatabase}; use ra_syntax::{ AstNode, ast, algo::find_node_at_offset, diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index 04f5a746e..b6d727399 100644 --- a/crates/ra_ide_api/src/hover.rs +++ b/crates/ra_ide_api/src/hover.rs @@ -1,4 +1,4 @@ -use ra_db::FilesDatabase; +use ra_db::SourceDatabase; use ra_syntax::{ AstNode, SyntaxNode, TreeArc, ast, algo::{find_covering_node, find_node_at_offset, find_leaf_at_offset, visit::{visitor, Visitor}}, diff --git a/crates/ra_ide_api/src/imp.rs b/crates/ra_ide_api/src/imp.rs index f2d41321d..1222fdc44 100644 --- a/crates/ra_ide_api/src/imp.rs +++ b/crates/ra_ide_api/src/imp.rs @@ -4,7 +4,7 @@ use hir::{ self, Problem, source_binder }; use ra_db::{ - FilesDatabase, SourceRoot, SourceRootId, + SourceDatabase, SourceRoot, SourceRootId, salsa::{Database, SweepStrategy}, }; use ra_ide_api_light::{self, assists, LocalEdit, Severity}; diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index 8380aa6c2..62a1934f4 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs @@ -34,7 +34,7 @@ use std::{fmt, sync::Arc}; use ra_syntax::{SourceFile, TreeArc, TextRange, TextUnit}; use ra_text_edit::TextEdit; use ra_db::{ - FilesDatabase, CheckCanceled, + SourceDatabase, CheckCanceled, salsa::{self, ParallelDatabase}, }; use rayon::prelude::*; diff --git a/crates/ra_ide_api/src/rename.rs b/crates/ra_ide_api/src/rename.rs index fe81609df..81ca0537c 100644 --- a/crates/ra_ide_api/src/rename.rs +++ b/crates/ra_ide_api/src/rename.rs @@ -17,7 +17,7 @@ use crate::{ SourceChange, SourceFileEdit, }; -use ra_db::FilesDatabase; +use ra_db::SourceDatabase; use relative_path::RelativePath; pub(crate) fn rename( diff --git a/crates/ra_ide_api/src/runnables.rs b/crates/ra_ide_api/src/runnables.rs index e21724207..0f2d00f13 100644 --- a/crates/ra_ide_api/src/runnables.rs +++ b/crates/ra_ide_api/src/runnables.rs @@ -3,7 +3,7 @@ use ra_syntax::{ TextRange, SyntaxNode, ast::{self, AstNode, NameOwner, ModuleItemOwner}, }; -use ra_db::FilesDatabase; +use ra_db::SourceDatabase; use crate::{db::RootDatabase, FileId}; diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs index 4d81d14b3..230ff410e 100644 --- a/crates/ra_ide_api/src/symbol_index.rs +++ b/crates/ra_ide_api/src/symbol_index.rs @@ -34,7 +34,7 @@ use ra_syntax::{ ast::{self, NameOwner}, }; use ra_db::{ - SourceRootId, FilesDatabase, + SourceRootId, SourceDatabase, salsa::{self, ParallelDatabase}, }; use rayon::prelude::*; diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs index cfa0257dd..16d23e140 100644 --- a/crates/ra_ide_api/src/syntax_highlighting.rs +++ b/crates/ra_ide_api/src/syntax_highlighting.rs @@ -1,5 +1,5 @@ use ra_syntax::{ast, AstNode,}; -use ra_db::FilesDatabase; +use ra_db::SourceDatabase; use crate::{ FileId, HighlightedRange, -- cgit v1.2.3