Move ide::AnalysisChange -> base_db::Change

This seems like a better factoring logically; ideally, clients shouldn't touch
`set_` methods of the database directly. Additionally, I think this
should remove the unfortunate duplication in fixture code.
This commit is contained in:
Aleksey Kladov 2020-10-02 15:45:09 +02:00
parent 700c9bc019
commit 8716c4cec3
11 changed files with 122 additions and 93 deletions

View file

@ -87,12 +87,11 @@ pub use assists::{
utils::MergeBehaviour, Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist,
};
pub use base_db::{
Canceled, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRoot,
Canceled, Change, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRoot,
SourceRootId,
};
pub use hir::{Documentation, Semantics};
pub use ide_db::{
change::AnalysisChange,
label::Label,
line_index::{LineCol, LineIndex},
search::SearchScope,
@ -141,7 +140,7 @@ impl AnalysisHost {
/// Applies changes to the current state of the world. If there are
/// outstanding snapshots, they will be canceled.
pub fn apply_change(&mut self, change: AnalysisChange) {
pub fn apply_change(&mut self, change: Change) {
self.db.apply_change(change)
}
@ -195,7 +194,7 @@ impl Analysis {
file_set.insert(file_id, VfsPath::new_virtual_path("/main.rs".to_string()));
let source_root = SourceRoot::new_local(file_set);
let mut change = AnalysisChange::new();
let mut change = Change::new();
change.set_roots(vec![source_root]);
let mut crate_graph = CrateGraph::default();
// FIXME: cfg options