Skip to content

A language server added while several projects are open starts once more in every other open project, for that project's open files #2224

Done

Description

@lagergren

What happens

With several projects open in one IDE, adding a language server definition (a user-defined server, or one that a plugin registers) starts the server in every open project, for the open files of all open projects. So a file gets one instance of the server per open project. All but one of these instances are started with another project's root and workspace folders.

Cause

When a definition is added, the LanguageServiceAccessor of every open project hears it. Its checkCurrentlyOpenFiles then goes through the open files of every open project (ProjectManager.getOpenProjects()). But it connects them through its own project (sendDidOpenAndRefreshEditorFeatureFor uses the accessor's project). So each project's accessor starts the server for the other projects' files too.

How to reproduce

  1. Open two projects, A and B, each with a file open that a language server would match.
  2. Add a user-defined language server for that file type.
  3. The LSP console shows two instances of the server for each file: one for the file's own project, and one started by the other project's accessor, with that project's root.

Seen in

The flaky LSPSemanticTokenDocumentationProviderTest.testPlainTextOfTwoLanguageServers on Linux CI (about 3 of 520 jobs since 2026-11-23). In the CI JVM, the light tests' shared project stays open. So addSecondServer started the second server twice, and the two starts raced in the test's mock server. When the test project's own start failed, the hover had only the first server's text.

Activity

  1. added this to the 0.30.2 milestone on Nov 25, 2026
  2. added
    bug
    on Nov 25, 2026
  3. added a commit that references this issue on Nov 25, 2026
    2d0cefb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions