anomalyco / anomalyco/opencode
workspacePullState ignores a server's static workspaceDiagnostics capability
@kitlangton is already working on this.
Since Aug 6, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
workspacePullState() ignores a language server's static diagnostic capability, while its neighbour documentPullState() accounts for it. packages/opencode/src/lsp/client.ts:355-377:
function documentPullState() {
...
supported: hasStaticPullDiagnostics || documentRegistrations.length > 0,
}
function workspacePullState() {
...
supported: workspaceRegistrations.length > 0,
}
hasStaticPullDiagnostics (line 258) comes from the initialize response. diagnosticRegistrations is only populated by client/registerCapability (lines 180-189). Under LSP 3.17 a server may declare diagnosticProvider: { workspaceDiagnostics: true } statically and never dynamically register — in which case workspacePullState().supported is false and requestFullDiagnostics (line 429-440) never issues the workspace pull, returning no diagnostics with no error surfaced.
There's currently no way to fix it by just OR-ing the flag in: ServerCapabilities.diagnosticProvider is typed unknown (line 67) and only ever Boolean()-checked, so nothing can read workspaceDiagnostics off it. The type needs narrowing first, which is why I'm raising it rather than sending a patch.
I should be upfront: I found this by reading the code, not by hitting it with a real server — so it's possible the conservative behaviour is deliberate and you'd rather only trust dynamic registrations. If so, this is really a request for a comment saying that.
OpenCode version
1.18.14 (dev @ 24470e5)
Steps to reproduce
- Use a language server that declares
capabilities.diagnosticProvider = { workspaceDiagnostics: true, interFileDependencies: false }in itsinitializeresponse and never sendsclient/registerCapabilityfortextDocument/diagnostic. - Run
opencode debug lsp diagnostics <file>against a file that was never opened viatextDocument/didOpen. - No diagnostics are returned; the workspace pull request is never sent.
Operating System
macOS 26.0.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.