You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
EditorBehaviorFeature keeps a flag computed while the file's language server starts across that language server's later changes #2261
EditorBehaviorFeature.compute reads the modification counts after LanguageServiceAccessor.getModificationTrackers(file) has looked up the started language servers of the file. That includes the project-level count, which changes whenever a language server changes status.
Take a language server that is created after that lookup and started before the counts are read:
its own tracker isn't kept;
the project-level count already includes its start.
hasAny still computes the flag from it. Its later changes, counted by its own tracker (LanguageServerWrapper.incrementModificationCount()), are missed, and the flag stays cached until a language server of the project changes status or definition.
EditorBehaviorFeatureTest.testAFlagThatChangesWhileItIsComputedIsComputedAgain failed once in 5 runs of its class, headless, on IU 2026.3, with "The flag must be computed again once it has changed while it was computed". In the test, the semantic tokens file view provider of test.ts (a TextMate file, since the JavaScript plugin is disabled in tests) can compute the flag that way while the test starts the language server.
How to reproduce
On its own it is rare: 0 failures in 20 runs of the class on IU 2026.3, 10 on IC 2024.2 and 10 on 2025.3, on one Mac.
To make it fail every time: hold a computation of the flag on another thread between the lookup of the servers and the read of the counts, for example with a latch in hashCode() of another started definition, which getModificationTrackers asks right after the lookup. While it is held, start the file's language server, then release it. If the language server's first answer changes its flag and calls incrementModificationCount(), the next calls of EditorBehaviorFeature.enableSemanticTokensFileViewProvider(file) keep the first answer.
Activity
fix: an editor behavior flag computed while the file's language serve…