fix(kotlin): handle workspace refresh requests to prevent LS shutdown

The Kotlin language server client advertises `refreshSupport` for
codeLens, semanticTokens, inlineValue, inlayHint and diagnostics, but
registered no handler for the corresponding `workspace/*/refresh`
requests.

When the server sends one, `LanguageServerProcess._request_handler`
finds no handler and replies with `MethodNotFound`. The Kotlin LSP
treats that error as fatal and terminates, which surfaces as
`LanguageServerTerminatedException` and kills any in-flight tool call.

Register no-op handlers for all five advertised capabilities, mirroring
what `svelte_language_server` already does.
This commit is contained in:
rr-develop committed 2026-08-03 11:02:06 +02:00
1 parent 29d07d4f6b
commit bfa45a6a11
1 file changed
+10
@@ -475,6 +475,16 @@ class KotlinLanguageServer(SolidLanguageServer):
self._indexing_complete.set()
self.server.on_request("client/registerCapability", do_nothing)
# We advertise `refreshSupport` for these features in the client
# capabilities above, so the server is entitled to send the matching
# refresh requests. Without a handler the client answers
# `MethodNotFound`, which the Kotlin LSP treats as fatal and shuts
# itself down, taking any in-flight request with it.
self.server.on_request("workspace/diagnostic/refresh", do_nothing)
self.server.on_request("workspace/inlayHint/refresh", do_nothing)
self.server.on_request("workspace/inlineValue/refresh", do_nothing)
self.server.on_request("workspace/semanticTokens/refresh", do_nothing)
self.server.on_request("workspace/codeLens/refresh", do_nothing)
self.server.on_notification("language/status", do_nothing)
self.server.on_notification("window/logMessage", window_log_message)
self.server.on_request("workspace/executeClientCommand", execute_client_command_handler)