Repository navigation
fix: create no instance for a request whose client features leave out its file - #1967
Conversation
… 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.
|
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 24 minutes. View limit details
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
Action not completed
|
|
@coderabbitai review |
Action not completed
|
…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.
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.
collectInstanceOfFilenow 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.testTheInstanceThatAMovedFileLeavesStopsWhenTheClientFeaturesOfItsNewRootAreCancelledwas 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
testARequestCreatesNoInstanceWhoseClientFeaturesLeaveOutTheFileasks 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,LanguageServerManagerInstancesTestpasses: 37 tests.The whole test suite passes locally, except for 7 tests that fail the same way on
mainon this machine, because macOS's temporary folder is outside the allowed roots. CI runs them on Linux.