You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opencode.ai/config.json schema uses top-level $ref/$defs, which breaks autocomplete/validation in the standard JSON LSP (neovim jsonls / VS Code) #41014
Since PR #26939 ("Generate config schema from Effect Schema", merged 2026-05-11) changed the generated config.json to use standard $defs/$ref instead of inlining, the schema at https://opencode.ai/config.json is no longer applied by the standard JSON language server (vscode-json-languageserver, used by both VS Code's built-in JSON support and neovim's jsonls).
vscode-json-languageserver does not apply a schema whose top level is a bare $ref (nor one carrying the non-standard allowComments/allowTrailingCommas keys). As a result there is no autocomplete and no schema validation when editing opencode.json / opencode.jsonc.
Before this change the schema was flat (type + properties at the top level) and worked fine. Confirmed broken in both:
neovim with jsonls (vscode-json-language-server)
VS Code (built-in JSON language features)
Repro
Open ~/.config/opencode/opencode.jsonc (or any opencode.json) in neovim (jsonls) or VS Code.
The file has "$schema": "https://opencode.ai/config.json".
Type at the top level of the object → no schema-based completions (e.g. provider, model, permission are not suggested); invalid keys are not flagged.
Compare: a sibling config pointing at a flat schema (e.g. oh-my-opencode-slim.jsonc) does get completions from the same LSP.
Root cause
Per my testing, vscode-json-languageserver fails to apply a schema when its top level is a bare $ref (and also when it carries the allowComments/allowTrailingCommas keys). Only a flat schema (type + properties, no $ref, no allowComments/allowTrailingCommas) is applied.
Suggested fix
Keep the generated schema usable by the standard JSON LSP, e.g. inline $defs.Config at the top level (flat type/properties) rather than a bare $ref, and/or drop the non-standard allowComments/allowTrailingCommas keys (or emit a flat schema that still conveys JSONC support).
Fresh Windows repro on 1.18.30: the published opencode.ai/config.json produces zero diagnostics in the standard JSON language server, even when explicitly enabling validation — so unknown keys in opencode.jsonc/omo.jsonc are never caught (no VS-Code-style squiggles).
Write it through opencode and read the write tool result's <diagnostics>.
Expected vs actual
Expected: a schema violation for bogusKey (Additional properties are not allowed ('bogusKey' was unexpected)), i.e. the same squiggle VS Code shows.
Actual: no diagnostics block for probe.json at all. Verified twice (two separate writes, server warm). The same directory does produce diagnostics for other servers, so the LSP pipeline itself works:
# control — same bare dir, same session:
<diagnostics file="...\global-lsp-probe\probe2.py">
ERROR [1:6] "(" was not closed
...
# probe.json → nothing
Mechanism
The published schema's root is a $ref into top-level $defs:
vscode-json-language-server (and neovim jsonls) resolve a document's schema from its $schema URI but do not dereference a bare top-level $ref + $defs the way ajv/opencode's own validator does, so the document ends up with no effective schema and no diagnostics. That matches the report in this issue; the fresh part here is that it also fails with json.validate.enable: true and the exact VS Code server, not just neovim.
Suggested fix direction: publish the schema with $defs inlined (or wrap it as {"type":"object","properties":{...}} with no top-level $ref), or serve a JSON-LS-compatible variant at a documented secondary URL.
Note (separate, already tracked elsewhere): .jsonc additionally never reaches the server with the right languageId because .jsonc is missing from LANGUAGE_EXTENSIONS (packages/opencode/src/lsp/language.ts:53 has ".json": "json", no .jsonc; client.ts:560 falls back to "plaintext"). Cross-ref: #15859 (comment added).
Activity
Bearmancer commentedon Sep 13, 2026
Fresh Windows repro on 1.18.30: the published
opencode.ai/config.jsonproduces zero diagnostics in the standard JSON language server, even when explicitly enabling validation — so unknown keys inopencode.jsonc/omo.jsoncare never caught (no VS-Code-style squiggles).Environment
Repro
probe.json:{"$schema":"https://opencode.ai/config.json","bogusKey":1}<diagnostics>.Expected vs actual
Expected: a schema violation for
bogusKey(Additional properties are not allowed ('bogusKey' was unexpected)), i.e. the same squiggle VS Code shows.Actual: no diagnostics block for
probe.jsonat all. Verified twice (two separate writes, server warm). The same directory does produce diagnostics for other servers, so the LSP pipeline itself works:Mechanism
The published schema's root is a
$refinto top-level$defs:{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$ref": "#/$defs/Config", "$defs": { "Config": { ... }, ... } }vscode-json-language-server(and neovimjsonls) resolve a document's schema from its$schemaURI but do not dereference a bare top-level$ref+$defsthe way ajv/opencode's own validator does, so the document ends up with no effective schema and no diagnostics. That matches the report in this issue; the fresh part here is that it also fails withjson.validate.enable: trueand the exact VS Code server, not just neovim.Suggested fix direction: publish the schema with
$defsinlined (or wrap it as{"type":"object","properties":{...}}with no top-level$ref), or serve a JSON-LS-compatible variant at a documented secondary URL.Note (separate, already tracked elsewhere):
.jsoncadditionally never reaches the server with the right languageId because.jsoncis missing fromLANGUAGE_EXTENSIONS(packages/opencode/src/lsp/language.ts:53has".json": "json", no.jsonc;client.ts:560falls back to"plaintext"). Cross-ref: #15859 (comment added).Verified 2026-09-13.
Bearmancer commentedon Sep 13, 2026
Environment (software)
~/.local/share/opencode/log/opencode.log·~/.omo/agent/OmO-debug.log·~/.omo/agent/logs/config-reload.logOS facts collected with:
No hardware, hostname, username, or credentials included.