Skip to content

A file opened while its language server starts can keep the editor behavior of a file that no language server serves (no Ctrl+hover on semantic tokens) #2157

Done

Description

@lagergren

What happens

EditorBehaviorFeature computes flags for each file from the file's language servers. The flags turn on:

  • the semantic tokens-based file view provider of TextMate, plain text and abstract file types;
  • the string literal, statement terminator, Enter between braces and TextMate nested braces improvements.

It caches each flag in a CachedValue whose dependencies are the language servers' modification trackers (LanguageServiceAccessor.getModificationTrackers(file)).

A CachedValue reads its dependencies' modification counts after it has computed the value (CachedValueBase.computeData). If the file's language server starts while a flag is computed, the start changes the counts before they're read. The cache then keeps the flag computed without the started server (false) until a language server changes again: one starts, stops, or has its configuration changed.

Effect

For a file opened as its language server starts, such as at IDE start or on first open:

  • No Ctrl+hover: the semantic tokens-based file view provider stays disabled. Highlighting shows the tokens, but none are kept in the view provider, so Ctrl+hover shows no hint and semantic-token navigation finds nothing.
  • No editor improvements: the improvements above are off.

The window is narrow, since the server's start must land inside one computation of the flag, so it's more likely under load.

Evidence

  • CI: LSPSemanticTokenDocumentationProviderTest.testPlainTextOfTwoLanguageServers failed at assertNotNull(hintText) in run 45191503838 (Linux, 2025.3, Nov 23) and run 42039103612 (Linux, 2024.2, Nov 5). Both times the hint was null 4–5 ms after the highlighting, with no warning. LSP features return nothing while LSP4IJ's indexing flags lag behind the platform (seen as a flaky LSPSemanticTokenDocumentationProviderTest) #2141 reports the same failure on 2026.3.
  • A traced local failure:
    • The flag's first computation ran inside configureByText and returned false, although the server had started by the time it ended.
    • The element at the caret was then the whole-file stub token, isIdentifier was UNSURE, and the hint was null in 0 ms.
  • Not new: a 500 ms pause inside that computation makes 12 of the test class's 15 tests fail on main, and 13 of 15 on 0.30.1. The caching code is unchanged since March 2025.
  • Under load on 2024.2: the class failed 10 times in 5,600 runs.

Fix

Read the counts before computing the flag, and compute it again once any of them has changed. A PR follows.

Activity

  1. added this to the 0.30.2 milestone on Nov 23, 2026
  2. added
    bug
    on Nov 23, 2026
  3. added a commit that references this issue on Nov 24, 2026
    6e6d7cb
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

    bughoversemantic tokens

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions