File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -326,6 +326,10 @@ func TestPushDiagnostics(t *testing.T) {
326326 // Request semantic diagnostics to trigger checking, which triggers the global type resolvers.
327327 ls , err := session .GetLanguageService (projecttestutil .WithRequestID (context .Background ()), lsproto .DocumentUri ("file:///src/index.ts" ))
328328 assert .NilError (t , err )
329+ // Drain background tasks from DidOpenFile (publishProgramDiagnostics, etc.)
330+ // before triggering global diagnostics, to avoid racing with publishGlobalDiagnostics.
331+ session .WaitForBackgroundTasks ()
332+
329333 _ , err = ls .ProvideDiagnostics (projecttestutil .WithRequestID (context .Background ()), lsproto .DocumentUri ("file:///src/index.ts" ))
330334 assert .NilError (t , err )
331335 // Enqueue global diagnostics publishing (normally done by the LSP server after each request).
You can’t perform that action at this time.
0 commit comments