anomalyco / anomalyco/opencode
opencode.ai/config.json schema uses top-level $ref/$defs, which breaks autocomplete/validation in the standard JSON LSP (neovim jsonls / VS Code)
@kitlangton is already working on this.
Since Aug 7, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
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).
The schema is now a bare top-level $ref wrapper:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$ref": "#/$defs/Config",
"$defs": { ... },
"allowComments": true,
"allowTrailingCommas": true
}
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 anyopencode.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,permissionare 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).
Related
- #26939 – introduced the
$defs/$refstructure - #2173 – previously added
allowComments/allowTrailingCommasspecifically for the VS Code JSON LSP
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.