diff options
| author | opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> | 2026-04-22 23:25:07 +0000 |
|---|---|---|
| committer | Aiden Cline <[email protected]> | 2026-04-23 00:25:40 -0400 |
| commit | 1cd4c92242ea75460100a0d69855a90938e07832 (patch) | |
| tree | 047844f77a18b04e97abee2f16ae09f1c2039faf | |
| parent | e383df4b17eecd6e6718e43c17438aa2eb818ee9 (diff) | |
| download | opencode-1cd4c92242ea75460100a0d69855a90938e07832.tar.gz opencode-1cd4c92242ea75460100a0d69855a90938e07832.zip | |
chore: generate
| -rw-r--r-- | packages/opencode/src/lsp/client.ts | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/packages/opencode/src/lsp/client.ts b/packages/opencode/src/lsp/client.ts index b0418ca3f..f6d5110a6 100644 --- a/packages/opencode/src/lsp/client.ts +++ b/packages/opencode/src/lsp/client.ts @@ -358,7 +358,10 @@ export async function create(input: { serverID: string; server: LSPServer.Handle return { handled, matched, byFile } } - async function requestWorkspaceDiagnosticReport(filePath: string, identifier?: string): Promise<DiagnosticRequestResult> { + async function requestWorkspaceDiagnosticReport( + filePath: string, + identifier?: string, + ): Promise<DiagnosticRequestResult> { const report = await withTimeout( connection.sendRequest<WorkspaceDiagnosticReport | null>("workspace/diagnostic", { ...(identifier ? { identifier } : {}), @@ -386,7 +389,9 @@ export async function create(input: { serverID: string; server: LSPServer.Handle (registration) => registration.registerOptions?.workspaceDiagnostics !== true, ) return { - documentIdentifiers: [...new Set(documentRegistrations.flatMap((registration) => registration.registerOptions?.identifier ?? []))], + documentIdentifiers: [ + ...new Set(documentRegistrations.flatMap((registration) => registration.registerOptions?.identifier ?? [])), + ], supported: hasStaticPullDiagnostics || documentRegistrations.length > 0, } } @@ -396,7 +401,9 @@ export async function create(input: { serverID: string; server: LSPServer.Handle (registration) => registration.registerOptions?.workspaceDiagnostics === true, ) return { - workspaceIdentifiers: [...new Set(workspaceRegistrations.flatMap((registration) => registration.registerOptions?.identifier ?? []))], + workspaceIdentifiers: [ + ...new Set(workspaceRegistrations.flatMap((registration) => registration.registerOptions?.identifier ?? [])), + ], supported: workspaceRegistrations.length > 0, } } @@ -461,7 +468,9 @@ export async function create(input: { serverID: string; server: LSPServer.Handle ...(documentState.supported ? [requestDiagnosticReport(filePath)] : []), ...documentState.documentIdentifiers.map((identifier) => requestDiagnosticReport(filePath, identifier)), ...(workspaceState.supported ? [requestWorkspaceDiagnosticReport(filePath)] : []), - ...workspaceState.workspaceIdentifiers.map((identifier) => requestWorkspaceDiagnosticReport(filePath, identifier)), + ...workspaceState.workspaceIdentifiers.map((identifier) => + requestWorkspaceDiagnosticReport(filePath, identifier), + ), ]), ) } @@ -532,8 +541,8 @@ export async function create(input: { serverID: string; server: LSPServer.Handle const remaining = DIAGNOSTICS_DOCUMENT_WAIT_TIMEOUT_MS - (Date.now() - startedAt) if (remaining <= 0) return const next = await Promise.race([ - pushWait.then((ready) => (ready ? "push" : "timeout" as const)), - waitForRegistrationChange(remaining).then((changed) => (changed ? "registration" : "timeout" as const)), + pushWait.then((ready) => (ready ? "push" : ("timeout" as const))), + waitForRegistrationChange(remaining).then((changed) => (changed ? "registration" : ("timeout" as const))), ]) if (next !== "registration") return } @@ -554,8 +563,8 @@ export async function create(input: { serverID: string; server: LSPServer.Handle const remaining = DIAGNOSTICS_FULL_WAIT_TIMEOUT_MS - (Date.now() - startedAt) if (remaining <= 0) return const next = await Promise.race([ - pushWait.then((ready) => (ready ? "push" : "timeout" as const)), - waitForRegistrationChange(remaining).then((changed) => (changed ? "registration" : "timeout" as const)), + pushWait.then((ready) => (ready ? "push" : ("timeout" as const))), + waitForRegistrationChange(remaining).then((changed) => (changed ? "registration" : ("timeout" as const))), ]) if (next !== "registration") return } |
