Improve support for multiple registrations of textDocument/diagnostic (#43703)
Closes https://github.com/zed-industries/zed/issues/41935 The registration ID responsible for generating each diagnostic is now tracked. This allows us to replace only the diagnostics from the same registration ID when a pull diagnostics report is applied. Additionally, various deficiencies in our support for pull diagnostics have been fixed: - Document pulls are issued for all open buffers, not just the edited one. A shorter debounce is used for the edited buffer. Workspace diagnostics are also now ignored for open buffers. - Tracking of `lastResultId` is improved. - Stored pull diagnostics are discarded when the corresponding buffer is closed. Release Notes: - Improved compatibility with language servers that use the "pull diagnostics" feature of Language Server Protocol. --------- Co-authored-by: Kirill Bulatov <mail4score@gmail.com> Co-authored-by: Kirill Bulatov <kirill@zed.dev>
This commit is contained in:
co-authored by
Kirill Bulatov
Kirill Bulatov
parent
493cfadb42
commit
a51e975b81
@@ -984,6 +984,8 @@ pub enum LspPullDiagnostics {
|
||||
server_id: LanguageServerId,
|
||||
/// URI of the resource,
|
||||
uri: lsp::Uri,
|
||||
/// The ID provided by the dynamic registration that produced diagnostics.
|
||||
registration_id: Option<SharedString>,
|
||||
/// The diagnostics produced by this language server.
|
||||
diagnostics: PulledDiagnostics,
|
||||
},
|
||||
@@ -994,10 +996,10 @@ pub enum PulledDiagnostics {
|
||||
Unchanged {
|
||||
/// An ID the current pulled batch for this file.
|
||||
/// If given, can be used to query workspace diagnostics partially.
|
||||
result_id: String,
|
||||
result_id: SharedString,
|
||||
},
|
||||
Changed {
|
||||
result_id: Option<String>,
|
||||
result_id: Option<SharedString>,
|
||||
diagnostics: Vec<lsp::Diagnostic>,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user