Don't fire no-op changes after files are saved to disk

This commit is contained in:
Aleksey Kladov 2019-12-22 13:56:19 +01:00
parent 436df298ba
commit 6acef5a7c0
2 changed files with 9 additions and 7 deletions

View File

@ -305,7 +305,6 @@ fn loop_turn(
log::info!("queued count = {}", queue_count);
}
let mut state_changed = false;
match event {
Event::Task(task) => {
on_task(task, &connection.sender, &mut loop_state.pending_requests, world_state);
@ -313,7 +312,6 @@ fn loop_turn(
}
Event::Vfs(task) => {
world_state.vfs.write().handle_task(task);
state_changed = true;
}
Event::Lib(lib) => {
world_state.add_lib(lib);
@ -338,7 +336,6 @@ fn loop_turn(
&mut loop_state.subscriptions,
not,
)?;
state_changed = true;
}
Message::Response(resp) => {
let removed = loop_state.pending_responses.remove(&resp.id);
@ -349,7 +346,12 @@ fn loop_turn(
},
};
loop_state.pending_libraries.extend(world_state.process_changes());
let mut state_changed = false;
if let Some(changes) = world_state.process_changes() {
state_changed = true;
loop_state.pending_libraries.extend(changes);
}
while loop_state.in_flight_libraries < MAX_IN_FLIGHT_LIBS
&& !loop_state.pending_libraries.is_empty()
{

View File

@ -145,10 +145,10 @@ impl WorldState {
/// FIXME: better API here
pub fn process_changes(
&mut self,
) -> Vec<(SourceRootId, Vec<(FileId, RelativePathBuf, Arc<String>)>)> {
) -> Option<Vec<(SourceRootId, Vec<(FileId, RelativePathBuf, Arc<String>)>)>> {
let changes = self.vfs.write().commit_changes();
if changes.is_empty() {
return Vec::new();
return None;
}
let mut libs = Vec::new();
let mut change = AnalysisChange::new();
@ -182,7 +182,7 @@ impl WorldState {
}
}
self.analysis_host.apply_change(change);
libs
Some(libs)
}
pub fn add_lib(&mut self, data: LibraryData) {