Repository navigation
fix: the LSP console's traces show a message of a language server that LSP4J can't parse, which only the IDE log had - #2213
Conversation
…t LSP4J can't parse, which only the IDE log had LSP4J hands a message that it can't parse, as a notification whose params don't fit their type, to its issue handler, which DefaultLauncherBuilder set to the remote endpoint, instead of to the message consumer that traces the messages. Such a message therefore never showed in the traces of the LSP console: a textDocument/publishDiagnostics notification with a character above the maximum integer of LSP showed nowhere but in the IDE log. The issue handler now traces the message first, as received, with the issues that LSP4J found in it, as "Message could not be parsed. java.lang.NumberFormatException: Expected an int but was 4294967295 at line 1 column 199 path $.params.diagnostics[0].range.end.character", and the params or result that LSP4J kept, at the verbose level. It then lets the remote endpoint handle the message as before. The trace of a request that can't be parsed lets the error response that LSP4J sends to it show its method, and the trace of a response that can't be parsed shows the method and the latency of its request. Part of redhat-developer#584
|
Warning Review limit reachedThis review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry. Next included review available in 17 minutes. View limit details
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2213 +/- ##
==========================================
+ Coverage 54.59% 54.63% +0.03%
==========================================
Files 834 834
Lines 35385 35434 +49
Branches 7300 5554 -1746
==========================================
+ Hits 19320 19359 +39
- Misses 13223 13230 +7
- Partials 2842 2845 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Combined, unchanged, with the other small fixes into #2219, one commit each, so that they take one review instead of six. |
Part of #584 (its part 2). Part 1 isn't LSP4IJ's: the server sends 4294967295, above LSP's maximum integer.
What
A message from a language server that LSP4J can't parse, such as a
publishDiagnosticswhosecharacteris 4294967295, went only to the IDE log, throughRemoteEndpoint.handle→logIssues. The LSP console's traces didn't show it, even with tracing on, so the message seemed never to have arrived.Change
DefaultLauncherBuilder.create()gives the message producer an issue handler of its own. It traces the message first, as parsed messages are traced (throughLanguageServerWrapper.logMessageIssuesand the lifecycle manager), then callsremoteEndpoint.handle(message, issues)as before, so LSP4J still answers or logs it.LSPTracegets anissuescomponent, and its earlier constructor stays.TracingMessageConsumer.logIssueswrites the trace:At the verbose level, the trace also shows the params or result that LSP4J kept.
For example:
Not in this PR:
DefaultLauncherBuilderdoesn't get this.The lifecycle listeners now also get
handleLSPMessagefor an unparsable message; the console needs it to refresh its traces.Tests
LSPConsoleUnparsableMessageTraceTest: the mock server sends thatpublishDiagnosticsas raw JSON, then awindow/logMessage. The console's traces show both, in order, and the server stays started.TracingMessageConsumerTest: an unparsable request and an unparsable response.DefaultLauncherBuilderhook, the traces show thewindow/logMessagebut not thepublishDiagnostics. With it, the test passes.console.*,server.*andCancelRequestAfterShutdownTeston all three platforms: 187 tests each, 0 failures. The 4 skipped tests are the existing Windows-onlyCommandUtilsTestcases.Behaviour change