Skip to content

feat: display server info on hover in LSP consoles view - #1996

Merged
lagergren merged 2 commits into
redhat-developer:mainfrom
sohamsakhare76-ai:display-server-info
Nov 17, 2026
Merged

lagergren merged 2 commits into
redhat-developer:mainfrom
sohamsakhare76-ai:display-server-info

Conversation

@sohamsakhare76-ai

Copy link
Copy Markdown
Contributor

Summary

  • Capture and retain the ServerInfo returned during language server initialization.
  • Display the server name and version in a tooltip when hovering over its definition node in the LSP Consoles view.
  • Handle missing server information gracefully.
  • Preserve server metadata after shutdown and clear it when the wrapper is disposed.

Testing

  • Added focused renderer tests for tooltip formatting and renderer state reset.
  • Added integration coverage for server metadata and tooltip rendering.
  • Executed .\gradlew test --tests "com.redhat.devtools.lsp4ij.console.*" — 41 tests passed.

Closes #386

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Language server names and versions are available in explorer tooltips. Tooltips show whichever details are provided and remain clear when information is unavailable.
    • Server metadata remains accessible after a server shuts down.
  • Documentation
    • Updated the user guide with information and a screenshot showing server details in tooltips.
  • Tests
    • Added coverage for tooltip display, clearing tooltips between rows, and retaining server metadata after shutdown.

The wrapper retains server info from initialization and exposes it through server and explorer nodes. The explorer tree displays available server info in a tooltip. Tests cover metadata access, tooltip formatting, and tooltip reset between rendered rows.

Changes: Server Info Tooltips

Layer / File(s) Summary
Retain and expose server info
src/main/java/com/redhat/devtools/lsp4ij/LanguageServerWrapper.java, src/main/java/com/redhat/devtools/lsp4ij/console/explorer/LanguageServerTreeNode.java
The wrapper stores server info from initialization, exposes it through getServerInfo(), and clears it on disposal. Tree nodes return info from the active process node, or null when none exists.
Render server info as a tooltip
src/main/java/com/redhat/devtools/lsp4ij/console/explorer/LanguageServerExplorer.java, src/main/java/com/redhat/devtools/lsp4ij/console/explorer/LanguageServerTreeRenderer.java, src/test/java/com/redhat/devtools/lsp4ij/console/LanguageServerExplorerLoadTest.java, src/test/java/com/redhat/devtools/lsp4ij/console/explorer/LanguageServerTreeRendererTest.java, docs/UserGuide.md
The explorer registers its tree with Swing’s tooltip manager. The renderer formats available server info and clears tooltips between rows. Tests cover metadata access and tooltip behavior. The guide describes the tooltip.

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant LanguageServer
  participant LanguageServerWrapper
  participant LanguageServerTreeNode
  participant LanguageServerTreeRenderer
  participant ToolTipManager
  participant User
  LanguageServer->>LanguageServerWrapper: Return ServerInfo during initialization
  LanguageServerTreeRenderer->>LanguageServerTreeNode: Request server info
  LanguageServerTreeNode->>LanguageServerWrapper: Read ServerInfo
  LanguageServerTreeRenderer->>ToolTipManager: Set formatted tooltip
  User->>ToolTipManager: Hover over explorer tree
  ToolTipManager-->>User: Display tooltip
Loading

Suggested reviewers: lagergren

Merge Risk: Minimal · up to 44259

The change adds a hover tooltip showing the language server name and version in the LSP Consoles view. No merge-blocking risk has been identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title accurately describes the main change: server info (name and version from the initialize response) is shown on hover in the LSP Consoles view. It follows the conventional-commit style and is …
Description check Passed The description states the purpose of the change: capturing ServerInfo at initialization, showing name and version in a hover tooltip, handling missing info, and preserving metadata after shutdown. It…
Linked Issues check Passed [#386] The issue asks that server info from the initialize response appears when hovering over the server node in the LSP Consoles view. The raw summary shows this implemented at the current head:
- L…
Out of Scope Changes check Passed Each changed file supports objective #386:
- LanguageServerWrapper: stores, exposes, and clears ServerInfo.
- LanguageServerTreeNode: adds the accessor used by the renderer.
- LanguageServerTreeRender…
Full details: Title check

Explanation

The title accurately describes the main change: server info (name and version from the initialize response) is shown on hover in the LSP Consoles view. It follows the conventional-commit style and is concise.

Full details: Description check

Explanation

The description states the purpose of the change: capturing ServerInfo at initialization, showing name and version in a hover tooltip, handling missing info, and preserving metadata after shutdown. It also lists tests run and links issue #386. It is directly related to the changeset.

Full details: Linked Issues check

Explanation

[#386] The issue asks that server info from the initialize response appears when hovering over the server node in the LSP Consoles view. The raw summary shows this implemented at the current head:

  • LanguageServerWrapper stores the nullable ServerInfo from initialization and exposes it through getServerInfo().
  • LanguageServerTreeNode.getServerInfo() returns info from the active process node, or null when none exists.
  • LanguageServerTreeRenderer sets a tooltip on server nodes from ServerInfo. formatServerInfo returns null for absent or blank data. Otherwise it returns the trimmed name and version.
  • LanguageServerExplorer registers the tree with ToolTipManager, which enables hover tooltips.
  • Metadata remains readable after shutdown and is cleared on dispose.
    Tests cover formatting, renderer reset between rows, and an integration path with mock-ls 1.2.3.
    The current head (44259ad) differs from the previously reviewed head (6f03c5c). The incremental diff was not available, so this conclusion rests on the whole-PR summary. The summary is specific enough to establish the required behavior.
Full details: Out of Scope Changes check

Explanation

Each changed file supports objective #386:

  • LanguageServerWrapper: stores, exposes, and clears ServerInfo.
  • LanguageServerTreeNode: adds the accessor used by the renderer.
  • LanguageServerTreeRenderer: sets and resets the tooltip and formats server info.
  • LanguageServerExplorer: registers the tree with ToolTipManager, which hover tooltips require.
  • LanguageServerExplorerLoadTest and LanguageServerTreeRendererTest: verify the new behavior.
  • docs/UserGuide.md: documents the hover behavior. This supports the objective.
  • docs/images/LSPConsoleServerInfo.png: excluded by the ignored_files rule for *.png. Its content was not reviewed. It is documentation only and does not affect the coding requirement.
    No unrelated behavior change appears in the summary. The incremental diff since 6f03c5c was not available, so this conclusion depends on the accuracy of the whole-PR summary.
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: 4f58ec8e-16e3-4a70-bd1a-3453600b6e3c
Commits

Reviewing files that changed from the base of the PR and between 6f03c5c and 44259ad.

Files ignored due to path filters: 1

  • docs/images/LSPConsoleServerInfo.png is excluded by !**/*.png
Files selected for processing: 1

  • docs/UserGuide.md

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

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.16%. Comparing base (2540f24) to head (44259ad).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1996      +/-   ##
==========================================
+ Coverage   48.95%   49.16%   +0.20%     
==========================================
  Files         812      812              
  Lines       32963    33017      +54     
  Branches     6732     5111    -1621     
==========================================
+ Hits        16138    16232      +94     
+ Misses      14276    14241      -35     
+ Partials     2549     2544       -5     

☔ 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.

@angelozerr

Copy link
Copy Markdown
Contributor

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Action performed

Full review finished.

@muescha

muescha commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Thanks! :) Could you please add some screenshots?

…le's tooltip

The screenshot is from IntelliJ IDEA Community 2024.2 (IC-242.20224.300) on
Linux, running this branch's plugin sandbox under Xvfb in a container. A
user-defined language server named "Demo", mapped to *.demo files, runs a
single-file Java server that answers initialize with serverInfo
{"name": "Demo Language Server", "version": "1.0.0"}; the tooltip appears
when hovering over its node in the Language Servers tool window.
@lagergren

Copy link
Copy Markdown
Collaborator

@muescha @sohamsakhare76-ai I've added the screenshot muescha asked for, in 44259ad. It's docs/images/LSPConsoleServerInfo.png, and the user guide's "LSP console" section now shows it, with a sentence on what the tooltip shows:

The LSP consoles view with the tooltip of a language server's node

It's IntelliJ IDEA Community 2024.2 with this branch. "Demo" is a user-defined language server, a small program that reports Demo Language Server 1.0.0 in its initialize response.

Once CI passes, I'll merge this for 0.30.0. Thanks, @sohamsakhare76-ai!

@lagergren lagergren added this to the 0.30.0 milestone Nov 17, 2026
@lagergren
lagergren merged commit 291a09e into redhat-developer:main Nov 17, 2026
9 checks passed
@muescha

muescha commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Thanks @sohamsakhare76-ai :)

@sohamsakhare76-ai

Copy link
Copy Markdown
Contributor Author

Thanks to you for the help @lagergren and @muescha loved to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display server info when hovering over server node in LSP consoles view

4 participants