mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Auto merge of #16639 - alibektas:13529/config_restruct, r=Veykril
internal : redesign rust-analyzer::config This PR aims to cover the infrastructural requirements for the `rust-analyzer.toml` ( #13529 ) issue. This means, that 1. We no longer have a single config base. The once single `ConfigData` has been divided into 4 : A tree of `.ratoml` files, a set of configs coming from the client ( this is what was called before the `CrateData` except that now values do not default to anything when they are not defined) , a set of configs that will reflect what the contents of a `ratoml` file defined in user's config directory ( e.g `~/.config/rust-analyzer/.rust-analyzer.toml` and finally a tree root that is populated by default values only. 2. Configs have also been divided into 3 different blocks : `global` , `local` , `client`. The current status of a config may change until #13529 got merged. Once again many thanks to `@cormacrelf` for doing all the serde work.
This commit is contained in:
commit
1179c3ee83
15 changed files with 1404 additions and 945 deletions
|
@ -66,7 +66,7 @@ use hir::ChangeWithProcMacros;
|
|||
use ide_db::{
|
||||
base_db::{
|
||||
salsa::{self, ParallelDatabase},
|
||||
CrateOrigin, Env, FileLoader, FileSet, SourceDatabase, VfsPath,
|
||||
CrateOrigin, Env, FileLoader, FileSet, SourceDatabase, SourceDatabaseExt, VfsPath,
|
||||
},
|
||||
prime_caches, symbol_index, FxHashMap, FxIndexSet, LineIndexDatabase,
|
||||
};
|
||||
|
@ -273,6 +273,10 @@ impl Analysis {
|
|||
self.with_db(|db| status::status(db, file_id))
|
||||
}
|
||||
|
||||
pub fn source_root(&self, file_id: FileId) -> Cancellable<SourceRootId> {
|
||||
self.with_db(|db| db.file_source_root(file_id))
|
||||
}
|
||||
|
||||
pub fn parallel_prime_caches<F>(&self, num_worker_threads: u8, cb: F) -> Cancellable<()>
|
||||
where
|
||||
F: Fn(ParallelPrimeCachesProgress) + Sync + std::panic::UnwindSafe,
|
||||
|
@ -282,7 +286,7 @@ impl Analysis {
|
|||
|
||||
/// Gets the text of the source file.
|
||||
pub fn file_text(&self, file_id: FileId) -> Cancellable<Arc<str>> {
|
||||
self.with_db(|db| db.file_text(file_id))
|
||||
self.with_db(|db| SourceDatabaseExt::file_text(db, file_id))
|
||||
}
|
||||
|
||||
/// Gets the syntax tree of the file.
|
||||
|
@ -292,7 +296,6 @@ impl Analysis {
|
|||
|
||||
/// Returns true if this file belongs to an immutable library.
|
||||
pub fn is_library_file(&self, file_id: FileId) -> Cancellable<bool> {
|
||||
use ide_db::base_db::SourceDatabaseExt;
|
||||
self.with_db(|db| db.source_root(db.file_source_root(file_id)).is_library)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue