Pull diagnostics fixes (#32242)

Follow-up of https://github.com/zed-industries/zed/pull/19230

* starts to send `result_id` in pull requests to allow servers to reply
with non-full results
* fixes a bug where disk-based diagnostics were offset after pulling the
diagnostics
* fixes a bug due to which pull diagnostics could not be disabled
* uses better names and comments for the workspace pull diagnostics part

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2025-06-06 16:18:05 +03:00 committed by GitHub
parent 508b604b67
commit 380d8c5662
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 272 additions and 109 deletions

View file

@ -127,6 +127,8 @@ pub struct Buffer {
has_unsaved_edits: Cell<(clock::Global, bool)>,
change_bits: Vec<rc::Weak<Cell<bool>>>,
_subscriptions: Vec<gpui::Subscription>,
/// The result id received last time when pulling diagnostics for this buffer.
pull_diagnostics_result_id: Option<String>,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
@ -955,6 +957,7 @@ impl Buffer {
completion_triggers_timestamp: Default::default(),
deferred_ops: OperationQueue::new(),
has_conflict: false,
pull_diagnostics_result_id: None,
change_bits: Default::default(),
_subscriptions: Vec::new(),
}
@ -2740,6 +2743,14 @@ impl Buffer {
pub fn preserve_preview(&self) -> bool {
!self.has_edits_since(&self.preview_version)
}
pub fn result_id(&self) -> Option<String> {
self.pull_diagnostics_result_id.clone()
}
pub fn set_result_id(&mut self, result_id: Option<String>) {
self.pull_diagnostics_result_id = result_id;
}
}
#[doc(hidden)]