Skip to content

Specify a schema to use when dealing with JSONC files#44250

Merged
SomeoneToIgnore merged 2 commits intomainfrom
kb/more-jsonc
Dec 5, 2025
Merged

Specify a schema to use when dealing with JSONC files#44250
SomeoneToIgnore merged 2 commits intomainfrom
kb/more-jsonc

Conversation

@SomeoneToIgnore
Copy link
Contributor

Follow-up of #43854
Closes #40970

Seems that json language server does not distinguish between JSONC and JSON files in runtime, but there is a static schema, which accepts globs in its fileMatch fields.

Use all glob overrides and file suffixes for JSONC inside those match fields, and provide a grammar for such matches, which accepts trailing commas.

Release Notes:

  • Improved JSONC trailing comma handling

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 5, 2025
@SomeoneToIgnore SomeoneToIgnore enabled auto-merge (squash) December 5, 2025 20:18
@SomeoneToIgnore SomeoneToIgnore merged commit a350438 into main Dec 5, 2025
24 checks passed
@SomeoneToIgnore SomeoneToIgnore deleted the kb/more-jsonc branch December 5, 2025 20:26
CherryWorm pushed a commit to CherryWorm/zed that referenced this pull request Dec 16, 2025
…#44250)

Follow-up of zed-industries#43854
Closes zed-industries#40970

Seems that json language server does not distinguish between JSONC and
JSON files in runtime, but there is a static schema, which accepts globs
in its `fileMatch` fields.

Use all glob overrides and file suffixes for JSONC inside those match
fields, and provide a grammar for such matches, which accepts trailing
commas.

Release Notes:

- Improved JSONC trailing comma handling
someone13574 pushed a commit to someone13574/zed that referenced this pull request Dec 16, 2025
…#44250)

Follow-up of zed-industries#43854
Closes zed-industries#40970

Seems that json language server does not distinguish between JSONC and
JSON files in runtime, but there is a static schema, which accepts globs
in its `fileMatch` fields.

Use all glob overrides and file suffixes for JSONC inside those match
fields, and provide a grammar for such matches, which accepts trailing
commas.

Release Notes:

- Improved JSONC trailing comma handling
@Zakleby
Copy link

Zakleby commented Dec 17, 2025

@SomeoneToIgnore
Hey after this update, when i use JSONC it adds trailing commas when i save. Below is an image
image

@SomeoneToIgnore
Copy link
Contributor Author

Yes, that's what an opinionated Prettier does when formatting jsonc files, so correct.
There's a whole entry in the docs for this: https://zed.dev/docs/languages/json?highlight=jsonc%20formatt#jsonc-prettier-formatting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSONC trailing comma warnings in bun.lock

2 participants