Skip to content

Commit d3f3727

Browse files
chore: generate
1 parent 8cade05 commit d3f3727

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

packages/opencode/src/lsp/client.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,10 @@ export async function create(input: { serverID: string; server: LSPServer.Handle
358358
return { handled, matched, byFile }
359359
}
360360

361-
async function requestWorkspaceDiagnosticReport(filePath: string, identifier?: string): Promise<DiagnosticRequestResult> {
361+
async function requestWorkspaceDiagnosticReport(
362+
filePath: string,
363+
identifier?: string,
364+
): Promise<DiagnosticRequestResult> {
362365
const report = await withTimeout(
363366
connection.sendRequest<WorkspaceDiagnosticReport | null>("workspace/diagnostic", {
364367
...(identifier ? { identifier } : {}),
@@ -386,7 +389,9 @@ export async function create(input: { serverID: string; server: LSPServer.Handle
386389
(registration) => registration.registerOptions?.workspaceDiagnostics !== true,
387390
)
388391
return {
389-
documentIdentifiers: [...new Set(documentRegistrations.flatMap((registration) => registration.registerOptions?.identifier ?? []))],
392+
documentIdentifiers: [
393+
...new Set(documentRegistrations.flatMap((registration) => registration.registerOptions?.identifier ?? [])),
394+
],
390395
supported: hasStaticPullDiagnostics || documentRegistrations.length > 0,
391396
}
392397
}
@@ -396,7 +401,9 @@ export async function create(input: { serverID: string; server: LSPServer.Handle
396401
(registration) => registration.registerOptions?.workspaceDiagnostics === true,
397402
)
398403
return {
399-
workspaceIdentifiers: [...new Set(workspaceRegistrations.flatMap((registration) => registration.registerOptions?.identifier ?? []))],
404+
workspaceIdentifiers: [
405+
...new Set(workspaceRegistrations.flatMap((registration) => registration.registerOptions?.identifier ?? [])),
406+
],
400407
supported: workspaceRegistrations.length > 0,
401408
}
402409
}
@@ -461,7 +468,9 @@ export async function create(input: { serverID: string; server: LSPServer.Handle
461468
...(documentState.supported ? [requestDiagnosticReport(filePath)] : []),
462469
...documentState.documentIdentifiers.map((identifier) => requestDiagnosticReport(filePath, identifier)),
463470
...(workspaceState.supported ? [requestWorkspaceDiagnosticReport(filePath)] : []),
464-
...workspaceState.workspaceIdentifiers.map((identifier) => requestWorkspaceDiagnosticReport(filePath, identifier)),
471+
...workspaceState.workspaceIdentifiers.map((identifier) =>
472+
requestWorkspaceDiagnosticReport(filePath, identifier),
473+
),
465474
]),
466475
)
467476
}
@@ -532,8 +541,8 @@ export async function create(input: { serverID: string; server: LSPServer.Handle
532541
const remaining = DIAGNOSTICS_DOCUMENT_WAIT_TIMEOUT_MS - (Date.now() - startedAt)
533542
if (remaining <= 0) return
534543
const next = await Promise.race([
535-
pushWait.then((ready) => (ready ? "push" : "timeout" as const)),
536-
waitForRegistrationChange(remaining).then((changed) => (changed ? "registration" : "timeout" as const)),
544+
pushWait.then((ready) => (ready ? "push" : ("timeout" as const))),
545+
waitForRegistrationChange(remaining).then((changed) => (changed ? "registration" : ("timeout" as const))),
537546
])
538547
if (next !== "registration") return
539548
}
@@ -554,8 +563,8 @@ export async function create(input: { serverID: string; server: LSPServer.Handle
554563
const remaining = DIAGNOSTICS_FULL_WAIT_TIMEOUT_MS - (Date.now() - startedAt)
555564
if (remaining <= 0) return
556565
const next = await Promise.race([
557-
pushWait.then((ready) => (ready ? "push" : "timeout" as const)),
558-
waitForRegistrationChange(remaining).then((changed) => (changed ? "registration" : "timeout" as const)),
566+
pushWait.then((ready) => (ready ? "push" : ("timeout" as const))),
567+
waitForRegistrationChange(remaining).then((changed) => (changed ? "registration" : ("timeout" as const))),
559568
])
560569
if (next !== "registration") return
561570
}

0 commit comments

Comments
 (0)