Skip to content

feat: name the command of a workspace/executeCommand request in its LSP console traces - #2055

Merged
lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:fix/name-the-command-in-execute-command-traces
Nov 21, 2026
Merged

lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:fix/name-the-command-in-execute-command-traces

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Fixes #284.

The LSP console traced a workspace/executeCommand request, and its response, with the method only:

[Trace - 16:14:46] Sending request 'workspace/executeCommand - (62)'.

So seeing which command a language server was asked to execute needed the verbose level, and a look at the params of the request. Both traces now name the command after the method, at every level:

[Trace - 16:14:46] Sending request 'workspace/executeCommand [gopls.reset_go_mod_diagnostics] - (62)'.
[Trace - 16:14:46] Received response 'workspace/executeCommand [gopls.reset_go_mod_diagnostics] - (62)' in 12ms.

TracingMessageConsumer reads the command from the params of the request: ExecuteCommandParams for a request that LSP4IJ sends, a JSON object for one that hasn't been read into its type. It keeps the name with the request, so the trace of the response shows it too. A request without a command is traced with its method only, as before, and so is every other request.

Not here: #19, the traces that the LSP console misses before its explorer exists, as at the start of the IDE. LanguageServerExplorerLifecycleListener queues the trace of a message only once the language server has a node in the explorer, so a request sent before that isn't traced, and its response shows <unknown> and a latency of ?.

Test: TracingMessageConsumerTest traces a workspace/executeCommand request that LSP4IJ sends, and its response, with the messages level and with the verbose one, and a received one with JSON params, and its response: each names the command. Without the change, these three tests fail. It also checks that a request without a command, and other requests, show their method only, and that a response without its request still shows <unknown>. It and the console, execute-command and trace tests pass (61 tests).

…SP console traces

The traces of a workspace/executeCommand request and of its response
showed only the method, so seeing which command a language server was
asked to execute needed the verbose level and a look at the params of the
request. They now show the command after the method, as
workspace/executeCommand [gopls.tidy], at every level: the params are
ExecuteCommandParams for a request that LSP4IJ sends, and JSON for one
that hasn't been read into its type. Without a command, the trace shows
the method only, as before.
@lagergren lagergren added this to the 0.30.2 milestone Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Traces for workspace/executeCommand requests now include the command name when available, making sent and received entries easier to identify. If the command name is unavailable, the trace displays the request method.

TracingMessageConsumer now includes the command name in outgoing and incoming workspace/executeCommand trace labels when the command is available as a string. Tests cover typed and JSON parameters, missing commands, other request methods, and responses without a matching request.

Changes: Command Trace Labels

Layer / File(s) Summary
Extract and display command names
src/main/java/com/redhat/devtools/lsp4ij/console/explorer/TracingMessageConsumer.java, src/test/java/com/redhat/devtools/lsp4ij/console/explorer/TracingMessageConsumerTest.java
The trace consumer adds an extracted command to outgoing and incoming workspace/executeCommand labels. If no string command is available, it retains the method-only label. Tests cover both directions and fallback cases.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: angelozerr

Merge Risk: Minimal · up to 5324c

This change appends the command name to workspace/executeCommand entries in the LSP console trace. The impact is limited to trace display, and requests without a command keep their existing labels. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: the LSP console trace for a workspace/executeCommand request and its response now includes the command name. The raw summary and objectives confirm this change in Tra…
Description check Passed The description matches the changeset. It explains that TracingMessageConsumer now reads the command from ExecuteCommandParams or JSON params and adds it to request and response traces. It describes t…
Linked Issues check Passed [#284] requires the LSP console to show the executed command on workspace/executeCommand request and response traces without verbose tracing. At the reviewed head, TracingMessageConsumer.getTracedMeth…
Out of Scope Changes check Passed The whole-PR change set, as summarized and as seen in the reviewed TracingMessageConsumer source, is limited to TracingMessageConsumer (command extraction, method labelling, and the required imports) …
Full details: Title check

Explanation

The title states the main change: the LSP console trace for a workspace/executeCommand request and its response now includes the command name. The raw summary and objectives confirm this change in TracingMessageConsumer and its new test. The title is 86 characters, which is slightly long but still concise and specific.

Full details: Description check

Explanation

The description matches the changeset. It explains that TracingMessageConsumer now reads the command from ExecuteCommandParams or JSON params and adds it to request and response traces. It describes the new TracingMessageConsumerTest cases, the unchanged behavior for other requests, and a known gap (#19) that is out of scope.

Full details: Linked Issues check

Explanation

[#284] requires the LSP console to show the executed command on workspace/executeCommand request and response traces without verbose tracing. At the reviewed head, TracingMessageConsumer.getTracedMethod(RequestMessage) appends the command as 'workspace/executeCommand [<command>]' when the method equals LSPRequestConstants.WORKSPACE_EXECUTE_COMMAND. getCommand reads ExecuteCommandParams.getCommand() for typed params and the string 'command' member for JsonObject params. consumeMessageSending and consumeMessageReceiving use this traced method in the 'messages' branch and the verbose branch, for both requests. The response branches reuse the method stored in RequestMetadata, so responses show the same command. This matches the issue's requested format. Requests without a command, and other methods, keep the plain method name. Unmatched responses still show '<unknown>'. The unit tests in TracingMessageConsumerTest were not read in this review. The PR description and raw summary report them, but this assessment does not rely on them for the verdict. Traces missed before the explorer node exists (#19) are out of scope for #284 and are not required here.

Full details: Out of Scope Changes check

Explanation

The whole-PR change set, as summarized and as seen in the reviewed TracingMessageConsumer source, is limited to TracingMessageConsumer (command extraction, method labelling, and the required imports) and the new TracingMessageConsumerTest. Every change supports the #284 objective. No unrelated behavior change for other request, notification, or response types was found. The diff read tool could not return the changed blobs, so the comparison relies on the reviewed head file and the PR summary, not on a text diff.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a14272aa-3c02-47e8-90d4-686a9f258715
Commits

Reviewing files that changed from the base of the PR and between b982bd4 and 5324cb0.

Files selected for processing: 2

  • src/main/java/com/redhat/devtools/lsp4ij/console/explorer/TracingMessageConsumer.java
  • src/test/java/com/redhat/devtools/lsp4ij/console/explorer/TracingMessageConsumerTest.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.61%. Comparing base (b982bd4) to head (5324cb0).

Files with missing lines Patch % Lines
...sp4ij/console/explorer/TracingMessageConsumer.java 85.71% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2055      +/-   ##
==========================================
+ Coverage   49.49%   49.61%   +0.12%     
==========================================
  Files         813      813              
  Lines       33350    33362      +12     
  Branches     5195     5200       +5     
==========================================
+ Hits        16505    16553      +48     
+ Misses      14272    14226      -46     
- Partials     2573     2583      +10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren
lagergren merged commit bd84106 into redhat-developer:main Nov 21, 2026
9 checks passed
@lagergren lagergren added enhancement New feature or request lsp-console labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lsp-console

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Append command name to workspace/executeCommand trace

1 participant