Skip to content

Fix(Language): Add language-configuration for comment toggle#433

Merged
1aron merged 1 commit intomaster-co:rcfrom
0Miles:fix/361-language-configuration
May 3, 2026
Merged

Fix(Language): Add language-configuration for comment toggle#433
1aron merged 1 commit intomaster-co:rcfrom
0Miles:fix/361-language-configuration

Conversation

@0Miles
Copy link
Copy Markdown
Contributor

@0Miles 0Miles commented May 1, 2026

Summary

packages/vscode/package.json's contributes.languages entry for master-css had no configuration field — there was no language-configuration.json. As a result, when the cursor sits inside meta.embedded.block.master-css.class (the embedded scope created by master-css.injection-react.json / injection-js.json / etc. for className={classNames(...)} etc.), VS Code asks the master-css language for comment characters, gets nothing, and the Toggle Line Comment shortcut becomes a no-op. That is the exact "doesn't work at all" symptom in #361.

Changes

  • packages/language/syntaxes/language-configuration.json (new) — lineComment: \"//\", blockComment: [\"/*\", \"*/\"], plus standard brackets, autoClosingPairs, surroundingPairs. The comment characters are JS-syntactic on purpose: when the cursor is inside an embedded master-css block within a TS/JS host file (the situation in the issue's screenshots), toggling produces a valid host-language comment.
  • packages/language/src/declaration.ts — adds configuration: './syntaxes/language-configuration.json'. packages/vscode/generate.ts propagates declaration verbatim into the language entry, so this is the single source of truth.
  • packages/vscode/package.json — pre-applies the same field so pnpm generate is a no-op after merge (and CI checks that compare hand-written vs generated stay green). Diff verified by re-running the generate logic locally — the rendered output matches byte-for-byte.
  • packages/language/tests/language-configuration.test.mjs (new) — 4 dependency-free node --test cases: JSON parses, line+block comments are present, brackets/auto-closing pairs are non-empty, and declaration.ts references the file. Runs as node --test packages/language/tests/language-configuration.test.mjs. No vitest deps added so this doesn't conflict with the separate feat/language-grammar-tests branch that introduces vitest to this package.

Why this scope

The issue's second screenshot ("works but syntax highlighting broken") is a separate grammar concern — fixing the missing language-configuration is necessary regardless and is the cleanly-isolatable change. Keeping this PR surgical means it can land independently.

Test plan

  • node --test packages/language/tests/language-configuration.test.mjs — 4/4 pass
  • tsx -e re-render of generate.ts's language emission matches the hand-applied edit in packages/vscode/package.json
  • Manual VS Code verification: install local VSIX, place cursor inside className={classNames(\"bg:white\", \"fg:black\")}, press Cmd/Ctrl+/, observe both lines toggle correctly

Closes #361

The `master-css` language declaration in `contributes.languages` had
no `configuration` pointing at a `language-configuration.json`. As a
result, VS Code had no comment characters for `.mcss` files or for
`meta.embedded.block.master-css.class` regions inside JS/TS host
files — pressing the Toggle Comment shortcut inside a `classNames(…)`
call did nothing.

This adds `packages/language/syntaxes/language-configuration.json`
with line/block comments (`//` and `/* */`), brackets, auto-closing
pairs and surrounding pairs, and wires it through `declaration.ts`
so the generated `packages/vscode/package.json` references it.

A dependency-free `node --test` regression covers the file shape and
the declaration link so the wiring can't silently regress.

Closes master-co#361
@vercel
Copy link
Copy Markdown

vercel Bot commented May 1, 2026

@0Miles is attempting to deploy a commit to the Aoyue Team on Vercel.

A member of the Team first needs to authorize it.

@1aron 1aron merged commit ade2325 into master-co:rc May 3, 2026
19 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐞 Master CSS syntax highlighting: Commenting out code doesn't work

2 participants