Protocols
Saved & recent

LSP diagnostics

Also called: publishDiagnostics, pull diagnostics

Diagnostics describe problems associated with a document, such as a syntax error or an unused variable. They carry ranges and messages, with optional information such as severity and codes. LSP 3.18 supports server-published diagnostics and a capability-dependent model in which the editor requests diagnostic reports.

In the publishing model, a new diagnostic list replaces the previous list for that document. If fixing a missing bracket removes the only error, the server sends an empty list to clear the editor’s marker. Sending nothing would leave the old report in place. This replacement rule matters when updates arrive repeatedly while someone types.

Read first
LSP document synchronization
Related
LSP document synchronization, JSON-RPC notifications, LSP initialization
Further reading
items = [1, 2 diagnostics: [1 issue] publishDiagnostics missing bracket marker items = [1, 2] diagnostics: [] publishDiagnostics published marker cleared push model · separate pull option
Publishing an empty diagnostic list clears an earlier problem marker for the same document.

View in the full Protocols collection