Skip to content

Commented-out JSONC lines still get full JSON syntax highlighting #55

Description

@GordonBeeming

What happens

Open a JSONC file (JSON with // comments, like the cmux settings template) and the commented-out lines keep their full JSON syntax highlighting — keys stay red, strings green, booleans amber. Only the // markers hint that the block is inert, so at a glance the file reads as if all those settings are active.

Commented JSONC lines still showing full JSON token colours

What should happen

Everything after // on a comment line renders in the muted comment colour, the way any other language's comments do.

Likely cause

.json files load the plain JSON grammar (src/language.ts), which has no comment support, so the parser treats // lines as ordinary (broken) JSON tokens and highlights them. Probably wants the JSONC variant of the CodeMirror JSON language for .json/.jsonc, or at least for .jsonc plus known comment-friendly files.

Repro

  1. Open any .json file that uses // comments (cmux's generated cmux.json template is a ready-made example).
  2. Look at the commented block - full token colours instead of comment styling.

Seen on v0.7 (dark theme, but theme-independent).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions