Skip to content

Hover: a hover cached before a language server was added or started is given again without that server's hover #2207

Done

Description

@lagergren

What happens

LSPHoverSupport keeps the future of the last hover of a file, and gives it again for a hover at the same offset while the file and the project's PSI are unchanged (AbstractLSPDocumentFeatureSupport.checkValid). Whether a language server was added, started or stopped since doesn't count. So a hover answered before a second language server of the file was ready keeps being given without that server's hover, until the file changes or the caret hovers elsewhere. Ctrl+hover on a semantic token (LSPSemanticTokenDocumentationProvider) and Quick Documentation both get it.

The caches are dropped when a language server stops (LanguageServerWrapper.disposeFileSupports) or the file closes, but not when a language server is added or starts.

How it was found

LSPSemanticTokenDocumentationProviderTest.testPlainTextOfTwoLanguageServers failed once on the Linux 2025.3 job of #2198, with only the first server's hover, right after testTheHoverOfALanguageServerWhenTheOtherOneCannotStart. A probe that hovers, adds a second language server and hovers again at the same offset, in one test, misses the second server's hover 9 times out of 10, and 0 times when the hover cache is cleared before the second hover.

Expected

A hover cached before a language server of the project was added, removed, started or stopped isn't given again. LanguageServiceAccessor already counts those changes in its modification tracker.

Test

Hover, add a second language server, hover again at the same offset: the second hover has both servers' hovers.

Activity

  1. added this to the 0.30.2 milestone on Nov 24, 2026
  2. added
    bug
    on Nov 24, 2026
  3. added 2 commits that reference this issue on Nov 24, 2026
    6f3b972
    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

    bughover

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions