Skip to content

fix: create no instance for a request whose client features leave out its file - #1967

Merged
lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:fix/request-creates-no-instance-that-leaves-out-its-file
Nov 11, 2026
Merged

lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:fix/request-creates-no-instance-that-leaves-out-its-file

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

For a definition with several instances, a request for a file created the instance of the file's root once the request's own filter took it. Only then did it ask the client features of that instance whether they take the file, and only to leave the instance out of the answer. If they left the file out, the instance stayed without a document, listed in the Language Servers view. #1932 fixed the same for a moved document.

collectInstanceOfFile now asks the client features of a new instance whether they take the file before it registers the instance, and disposes it otherwise, as the move does since #1932. An instance that exists already is unchanged.

This was also why LanguageServerManagerInstancesTest.testTheInstanceThatAMovedFileLeavesStopsWhenTheClientFeaturesOfItsNewRootAreCancelled was flaky: it failed today on Windows in #1942 and on macOS in #1964. After the move, a feature of the editor that asked for the moved file could create the instance of its new root, whose client features were cancelled. Whether it did depended on whether that request came before or after the test's check.

Tests

testARequestCreatesNoInstanceWhoseClientFeaturesLeaveOutTheFile asks for a file whose instance leaves it out, with a filter that takes every language server. Without the fix, it fails every time with the same assertion as the flaky test. With it, LanguageServerManagerInstancesTest passes: 37 tests.

The whole test suite passes locally, except for 7 tests that fail the same way on main on this machine, because macOS's temporary folder is outside the allowed roots. CI runs them on Linux.

… its file

For a definition with several instances, a request for a file created
the instance of the file's root once the request's own filter took it,
and only then asked the client features of that instance whether they
take the file. If they left it out, the instance stayed without a
document, listed in the Language Servers view, as redhat-developer#1932 fixed for a
moved document. The request now asks them before it registers a new
instance, and disposes it otherwise.

This also made a test of redhat-developer#1932 flaky: after a move, a feature of the
editor that asked for the moved file could create the instance of its
new root, whose client features were cancelled.
@lagergren lagergren added this to the 0.30.0 milestone Nov 11, 2026
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

This 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 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

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: ffb1873f-1e83-4c67-b4b9-7361c965fc45
Commits

Reviewing files that changed from the base of the PR and between 72f5afe and d3ccde5.

Files selected for processing: 2

  • src/main/java/com/redhat/devtools/lsp4ij/LanguageServiceAccessor.java
  • src/test/java/com/redhat/devtools/lsp4ij/LanguageServerManagerInstancesTest.java

@codecov

codecov Bot commented Nov 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.16%. Comparing base (b80ec21) to head (d3ccde5).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1967   +/-   ##
=======================================
  Coverage   48.16%   48.16%           
=======================================
  Files         809      809           
  Lines       32486    32488    +2     
  Branches     5013     5014    +1     
=======================================
+ Hits        15647    15649    +2     
  Misses      14341    14341           
  Partials     2498     2498           

☔ 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 11, 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 11, 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
lagergren merged commit 7f21529 into redhat-developer:main Nov 11, 2026
11 checks passed
lagergren added a commit that referenced this pull request Nov 16, 2026
…1997)

For a definition with several instances, each instance has client
features, and so a server installer set in createClientFeatures(), of
its own. Until that installer has checked the installation,
isEnabled(file) returns false. Since #1932 and #1967, a new instance
whose client features leave out its file is disposed with its check.
When the check ends, the installer starts the definition, which creates
a new instance with a new installer and a new check: the file is never
connected, and the checks keep starting each other.

A request and a move now keep a new instance whose client features wait
for the check of their installer, also when the filter of the request
asked them, as the language server of a definition without instances
stays while it installs. The start of the definition at the end of the
check starts the instance and connects its files. Until then, neither
the start after the check of another instance, nor a request without a
file, nor getLanguageServer(id) starts it.

Reported by d-biehl in #1932.
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.

1 participant