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)

Open
#41,014 2 comments 0 reactions 1 assignee View on GitHub

@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
  1. Open ~/.config/opencode/opencode.jsonc (or any opencode.json) in neovim (jsonls) or VS Code.
  2. The file has "$schema": "https://opencode.ai/config.json".
  3. 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).

Related
  • #26939 – introduced the $defs/$ref structure
  • #2173 – previously added allowComments/allowTrailingCommas specifically for the VS Code JSON LSP

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.