@@ -17,7 +17,6 @@ const DIAGNOSTICS_DEBOUNCE_MS = 150
1717const DIAGNOSTICS_POLL_MS = 500
1818const DIAGNOSTICS_REQUEST_TIMEOUT_MS = 2_000
1919const DIAGNOSTICS_WAIT_TIMEOUT_MS = 3_000
20- const DIAGNOSTICS_PULL_WAIT_TIMEOUT_MS = 10_000
2120const DIAGNOSTICS_SETTLE_MS = 1_500
2221
2322const log = Log . create ( { service : "lsp.client" } )
@@ -269,18 +268,15 @@ export async function create(input: { serverID: string; server: LSPServer.Handle
269268 )
270269 if ( ! hasStaticPullDiagnostics && registrations . length === 0 ) return false
271270
272- const results : Awaited < ReturnType < typeof requestDiagnosticReport > > [ ] = [ ]
273- if ( hasStaticPullDiagnostics ) {
274- results . push ( await requestDiagnosticReport ( filePath ) )
275- }
276271 const identifiers = new Set (
277272 registrations
278273 . map ( ( registration ) => registration . registerOptions ?. identifier )
279274 . filter ( ( identifier ) : identifier is string => Boolean ( identifier ) ) ,
280275 )
281- for ( const identifier of identifiers ) {
282- results . push ( await requestDiagnosticReport ( filePath , identifier ) )
283- }
276+ const results = await Promise . all ( [
277+ ...( hasStaticPullDiagnostics ? [ requestDiagnosticReport ( filePath ) ] : [ ] ) ,
278+ ...[ ...identifiers ] . map ( ( identifier ) => requestDiagnosticReport ( filePath , identifier ) ) ,
279+ ] )
284280
285281 const handled = results . some ( ( result ) => result . handled )
286282 if ( ! handled ) return false
@@ -389,7 +385,6 @@ export async function create(input: { serverID: string; server: LSPServer.Handle
389385 log . info ( "waiting for diagnostics" , { path : normalizedPath } )
390386
391387 const canPull = hasStaticPullDiagnostics || diagnosticRegistrations . size > 0
392- const timeout = canPull ? DIAGNOSTICS_PULL_WAIT_TIMEOUT_MS : DIAGNOSTICS_WAIT_TIMEOUT_MS
393388
394389 // Shared stop flag: whichever branch wins the race (or the outer
395390 // timeout) sets this so the other branch bails before issuing more work.
@@ -427,7 +422,7 @@ export async function create(input: { serverID: string; server: LSPServer.Handle
427422 }
428423
429424 const race = canPull ? Promise . race ( [ waitForPush , waitForPull ( ) ] ) : waitForPush
430- return await withTimeout ( race , timeout )
425+ return await withTimeout ( race , DIAGNOSTICS_WAIT_TIMEOUT_MS )
431426 . catch ( ( ) => { } )
432427 . finally ( ( ) => {
433428 stopped = true
0 commit comments