Debounce language server file system events (#30773)

This helps prevent a race condition where the language server would
update in the middle of a `git checkout`

Release Notes:

- N/A
This commit is contained in:
Agus Zubiaga 2025-05-20 11:00:28 +02:00 committed by GitHub
parent df66237428
commit b1c7fa1dac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 63 additions and 20 deletions

View file

@ -1,8 +1,8 @@
#![allow(clippy::format_collect)]
use crate::{
Event, git_store::StatusEntry, task_inventory::TaskContexts, task_store::TaskSettingsLocation,
*,
Event, git_store::StatusEntry, lsp_store::FS_WATCH_DEBOUNCE_TIMEOUT,
task_inventory::TaskContexts, task_store::TaskSettingsLocation, *,
};
use buffer_diff::{
BufferDiffEvent, CALCULATE_DIFF_TASK, DiffHunkSecondaryStatus, DiffHunkStatus,
@ -1190,6 +1190,9 @@ async fn test_reporting_fs_changes_to_language_servers(cx: &mut gpui::TestAppCon
// The language server receives events for the FS mutations that match its watch patterns.
cx.executor().run_until_parked();
cx.executor().advance_clock(FS_WATCH_DEBOUNCE_TIMEOUT);
cx.executor().run_until_parked();
assert_eq!(
&*file_changes.lock(),
&[