mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Don't fire no-op changes after files are saved to disk
This commit is contained in:
parent
436df298ba
commit
6acef5a7c0
2 changed files with 9 additions and 7 deletions
|
@ -305,7 +305,6 @@ fn loop_turn(
|
||||||
log::info!("queued count = {}", queue_count);
|
log::info!("queued count = {}", queue_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut state_changed = false;
|
|
||||||
match event {
|
match event {
|
||||||
Event::Task(task) => {
|
Event::Task(task) => {
|
||||||
on_task(task, &connection.sender, &mut loop_state.pending_requests, world_state);
|
on_task(task, &connection.sender, &mut loop_state.pending_requests, world_state);
|
||||||
|
@ -313,7 +312,6 @@ fn loop_turn(
|
||||||
}
|
}
|
||||||
Event::Vfs(task) => {
|
Event::Vfs(task) => {
|
||||||
world_state.vfs.write().handle_task(task);
|
world_state.vfs.write().handle_task(task);
|
||||||
state_changed = true;
|
|
||||||
}
|
}
|
||||||
Event::Lib(lib) => {
|
Event::Lib(lib) => {
|
||||||
world_state.add_lib(lib);
|
world_state.add_lib(lib);
|
||||||
|
@ -338,7 +336,6 @@ fn loop_turn(
|
||||||
&mut loop_state.subscriptions,
|
&mut loop_state.subscriptions,
|
||||||
not,
|
not,
|
||||||
)?;
|
)?;
|
||||||
state_changed = true;
|
|
||||||
}
|
}
|
||||||
Message::Response(resp) => {
|
Message::Response(resp) => {
|
||||||
let removed = loop_state.pending_responses.remove(&resp.id);
|
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
|
while loop_state.in_flight_libraries < MAX_IN_FLIGHT_LIBS
|
||||||
&& !loop_state.pending_libraries.is_empty()
|
&& !loop_state.pending_libraries.is_empty()
|
||||||
{
|
{
|
||||||
|
|
|
@ -145,10 +145,10 @@ impl WorldState {
|
||||||
/// FIXME: better API here
|
/// FIXME: better API here
|
||||||
pub fn process_changes(
|
pub fn process_changes(
|
||||||
&mut self,
|
&mut self,
|
||||||
) -> Vec<(SourceRootId, Vec<(FileId, RelativePathBuf, Arc<String>)>)> {
|
) -> Option<Vec<(SourceRootId, Vec<(FileId, RelativePathBuf, Arc<String>)>)>> {
|
||||||
let changes = self.vfs.write().commit_changes();
|
let changes = self.vfs.write().commit_changes();
|
||||||
if changes.is_empty() {
|
if changes.is_empty() {
|
||||||
return Vec::new();
|
return None;
|
||||||
}
|
}
|
||||||
let mut libs = Vec::new();
|
let mut libs = Vec::new();
|
||||||
let mut change = AnalysisChange::new();
|
let mut change = AnalysisChange::new();
|
||||||
|
@ -182,7 +182,7 @@ impl WorldState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.analysis_host.apply_change(change);
|
self.analysis_host.apply_change(change);
|
||||||
libs
|
Some(libs)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_lib(&mut self, data: LibraryData) {
|
pub fn add_lib(&mut self, data: LibraryData) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue