From e38c0dfd626994e2559b655cc888de5b2bb3fddc Mon Sep 17 00:00:00 2001 From: Ludwig Valda Vasquez Date: Tue, 7 Oct 2025 19:00:47 +0200 Subject: [PATCH] [air] lsp: add pull diagnostics, fix other pulls We'd only pull markup (such as inlay hints, code lenses, etc.) in response to the "workspace/*/refresh" notifications, which is what rust-analyzer sends on every document change, but that's not how it is supposed to work. By the spec, those notifications should occur whenever a project-wide change was detected by the server that may have affected all documents' markup. The expected behaviour is that the client (Air) requests the changes for all the markup whenever it thinks it's convenient and warranted. This translates into requests on any document change. It wasn't necessary with rust-analyzer, since the original way worked, but we didn't get any live updates to inlay hints and others when using different language servers, such as typescript LSP server. In addition, a dignostic pull was added with the same kind of trigger (on every document change). This is necessary to support kotlin LSP, which doesn't ever send textDocument/publishDiagnostic notification. GitOrigin-RevId: 5df5c2981336fe0fba1cb5e04c6883deef2e9bd6 --- .../com/jetbrains/lsp/protocol/Diagnostics.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fleet/lsp.protocol/srcCommonMain/com/jetbrains/lsp/protocol/Diagnostics.kt b/fleet/lsp.protocol/srcCommonMain/com/jetbrains/lsp/protocol/Diagnostics.kt index 787003768d2c..cc9b90146c90 100644 --- a/fleet/lsp.protocol/srcCommonMain/com/jetbrains/lsp/protocol/Diagnostics.kt +++ b/fleet/lsp.protocol/srcCommonMain/com/jetbrains/lsp/protocol/Diagnostics.kt @@ -279,11 +279,9 @@ data class DocumentDiagnosticParams( */ val previousResultId: String? = null, - override val workDoneToken: ProgressToken?, - - override val partialResultToken: ProgressToken?, - - ) : WorkDoneProgressParams, PartialResultParams + override val workDoneToken: ProgressToken? = null, + override val partialResultToken: ProgressToken? = null, +) : WorkDoneProgressParams, PartialResultParams @Serializable enum class DocumentDiagnosticReportKind { @@ -352,5 +350,5 @@ object Diagnostics { ) val Refresh: RequestType = - RequestType("textDocument/diagnostics/refresh", Unit.serializer(), Unit.serializer(), Unit.serializer()) + RequestType("workspace/diagnostic/refresh", Unit.serializer(), Unit.serializer(), Unit.serializer()) } \ No newline at end of file