Skip to content

fix: show the language servers that started before the Language Servers view opened - #1859

Merged
angelozerr merged 1 commit into
redhat-developer:mainfrom
d-biehl:fix/language-servers-view-started-servers
Nov 4, 2026
Merged

angelozerr merged 1 commit into
redhat-developer:mainfrom
d-biehl:fix/language-servers-view-started-servers

Conversation

@d-biehl

@d-biehl d-biehl commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Split from #1853, as you asked.

When the Language Servers view opens, LanguageServerExplorer.loadAsync runs two steps: it loads the definitions and creates their nodes, and it loads the started servers and creates their process nodes. The two run as separate non-blocking read actions, so their order isn't fixed. When the started servers come first, their definition has no node yet. updateServerStatus then returns without doing anything, and the status of that server is lost. The view shows the server without a process node, so without its status and its consoles, until its next LSP message or status change creates the node. For an idle server, that can take a while.

To see it, start a language server by opening a file, and then open the Language Servers view for the first time in that project. It doesn't happen every time, because it depends on which step finishes first.

The second step now starts when the first one has finished. Nothing else changes.

LanguageServerExplorerLoadTest opens the view ten times with a server already running, and it fails without the fix. Locally, on Linux, ./gradlew check passes (1,136 tests, 3 skipped). In PyCharm 2026.1 with RobotCode and a server already running, 15 of 25 new panels had no process node without the fix, and all 25 had it with the fix.

…rs view opened

LanguageServerExplorer.loadAsync loaded the definitions and the started servers
in parallel. When the started servers came first, their definition had no node
yet and their status was lost, so the view showed no process node until the next
LSP message or status change.

The started servers are now loaded after the definitions.

Signed-off-by: Daniel Biehl <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 4, 2026 16:40
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where the language server console could fail to show a server that was already running when the console opened. The server and its active process now appear reliably with the correct started status, including when the console is opened and closed repeatedly.

The explorer now loads started-server state after adding server definitions to the tree and stopping the loading spinner. A regression test checks that a server started before the console opens appears with started status across repeated panel openings.

Changes: Explorer loading

Layer / File(s) Summary
Started-server loading and regression test
src/main/java/com/redhat/devtools/lsp4ij/console/LSPConsoleToolWindowPanel.java, src/main/java/com/redhat/devtools/lsp4ij/console/explorer/LanguageServerExplorer.java, src/test/java/com/redhat/devtools/lsp4ij/console/LanguageServerExplorerLoadTest.java
The panel adds a test-only accessor for its explorer. The explorer loads started-server state after adding definition nodes and stopping the spinner. The test checks the server status across repeated panel openings.

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

Change: Bug fix

Suggested reviewers: angelozerr

Merge Risk: Minimal · up to 2e9e6

No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title names the main change: the fix makes language servers that started before the Language Servers view opened appear with their process nodes and status. This matches the raw summary (loadStart…
Description check Passed The description is closely related to the changeset. It explains the race between the two non-blocking read actions in LanguageServerExplorer.loadAsync, why started-server status is lost when it loads…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the fix makes language servers that started before the Language Servers view opened appear with their process nodes and status. This matches the raw summary (loadStartedServersAsync now runs after definition nodes are added) and the objectives (a race between definition and started-server loading). The title follows the conventional commit prefix and is 83 characters, which is acceptable.

Full details: Description check

Explanation

The description is closely related to the changeset. It explains the race between the two non-blocking read actions in LanguageServerExplorer.loadAsync, why started-server status is lost when it loads first, and that the fix defers the second step until the first completes. It also describes the new LanguageServerExplorerLoadTest and the verification performed. This matches the summary and objectives.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 3 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

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: a6109a21-d470-4f6f-881c-4ba40db81d1f
Commits

Reviewing files that changed from the base of the PR and between d1a281d and 2e9e6e8.

Files selected for processing: 3
  • src/main/java/com/redhat/devtools/lsp4ij/console/LSPConsoleToolWindowPanel.java
  • src/main/java/com/redhat/devtools/lsp4ij/console/explorer/LanguageServerExplorer.java
  • src/test/java/com/redhat/devtools/lsp4ij/console/LanguageServerExplorerLoadTest.java

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the change addressing the Language Servers view initialization race.

No open issues 🎉

What changed in this PR

Fixes an initialization race in the Language Servers view that could leave already-running servers without process nodes, status, or consoles until a later server event.

Changes:

  • Loads started-server state only after definition nodes have been created.
  • Adds a test-only accessor for the panel’s explorer.
  • Adds a regression test that opens the view ten times and checks an existing server’s process node and status.
File Description
src/​test/​java/​com/​redhat/​devtools/​lsp4ij/​console/​LanguageServerExplorerLoadTest.java Tests loading the view with an already-started server.
src/​main/​java/​com/​redhat/​devtools/​lsp4ij/​console/​LSPConsoleToolWindowPanel.java Exposes the explorer through a package-private, test-only accessor.
src/​main/​java/​com/​redhat/​devtools/​lsp4ij/​console/​explorer/​LanguageServerExplorer.java Sequences started-server loading after definition-node creation.

Review effort: Balanced

@codecov

codecov Bot commented Nov 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 43.43%. Comparing base (d1a281d) to head (2e9e6e8).

Files with missing lines Patch % Lines
...sp4ij/console/explorer/LanguageServerExplorer.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1859      +/-   ##
==========================================
+ Coverage   42.67%   43.43%   +0.76%     
==========================================
  Files         798      798              
  Lines       30562    30565       +3     
  Branches     6116     6116              
==========================================
+ Hits        13042    13276     +234     
+ Misses      15293    15008     -285     
- Partials     2227     2281      +54     

☔ 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 4, 2026 •

Copy link
Copy Markdown
Action performed

Full review finished.

@angelozerr
angelozerr self-requested a review November 4, 2026 17:06
@angelozerr angelozerr added the bug Something isn't working label Nov 4, 2026
@angelozerr angelozerr added this to the 0.30.0 milestone Nov 4, 2026
@angelozerr angelozerr moved this to In Progress in Java Tooling Nov 4, 2026
@angelozerr

Copy link
Copy Markdown
Contributor

LGTM, thanks @d-biehl !

@angelozerr
angelozerr merged commit 8c405bb into redhat-developer:main Nov 4, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Java Tooling Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants