Skip to content

A request for one language server definition misses a definition that matches the file asynchronously #1913

Closed

Description

@lagergren

LanguageServiceAccessor.getLanguageServers(psiFile, beforeStartingServerFilter, afterStartingServerFilter, serverDefinition) gives no language server for a definition that matches the file only through a mapping that is matched asynchronously (shouldBeMatchedAsynchronously).

How it happens

When it is given a definition, getMatchedLanguageServersWrappers checks it against mappings.getMatched(), the synchronous matches, and returns nothing if it isn't among them:

        if (matchServerDefinition != null) {
            if (!serverDefinitions.contains(matchServerDefinition)) {
                return CompletableFuture.completedFuture(Collections.emptyList());
            }

The asynchronous matches, mappings.getAsyncMatched(), are looked at only after that, so a definition that is matched only asynchronously never gets that far.

sendDidOpenAndRefreshEditorFeatureFor asks for the open files of a definition this way, as after a restart of the definition. So an open file that a definition matches asynchronously gets no didOpen and no refresh of its editor features from it then, until another request connects it. #1911 asks this way too, for an open file that moved as its instance was chosen.

Possible fix

When a definition is given and isn't among the synchronous matches, wait for the asynchronous matches, and keep the definition if it is among them, as the request without a definition does.

Found in the review of #1911, from the code.

Activity

  1. self-assigned this
    on Nov 9, 2026
  2. added a commit that references this issue on Nov 9, 2026
    e8f8960
  3. added a commit that references this issue on Nov 10, 2026
    42b4e25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions