Fix $inner object-form detection and reject empty selections - #4114
Open
DmitrySharabin wants to merge 1 commit into
Open
DmitrySharabin wants to merge 1 commit into
DmitrySharabin wants to merge 1 commit into
Conversation
DmitrySharabin
added this pull request to stack #4113
September 17, 2026 07:58
✅ Deploy Preview for dev-prismjs-com ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
DmitrySharabin
removed this pull request from stack #4113
September 17, 2026 08:01
DmitrySharabin
changed the base branch from
claude/split-token-stream-perf
to
v2
September 17, 2026 08:01
DmitrySharabin
force-pushed
the
claude/inner-spec-detection
branch
from
September 17, 2026 08:01
c817ab8 to
9d11c85
Compare
DmitrySharabin
changed the base branch from
v2
to
claude/compassionate-brahmagupta-94vewq
September 17, 2026 08:02
DmitrySharabin
added this pull request to stack #4115
September 17, 2026 08:02
DmitrySharabin
removed this pull request from stack #4115
September 22, 2026 08:35
DmitrySharabin
changed the base branch from
claude/compassionate-brahmagupta-94vewq
to
v2
September 22, 2026 08:48
DmitrySharabin
force-pushed
the
claude/inner-spec-detection
branch
from
September 22, 2026 08:48
9d11c85 to
6fe21cb
Compare
DmitrySharabin
changed the base branch from
v2
to
claude/split-token-stream-perf
September 22, 2026 08:48
DmitrySharabin
added this pull request to stack #4124
September 22, 2026 08:48
DmitrySharabin
removed this pull request from stack #4124
September 22, 2026 08:49
Base automatically changed from
claude/split-token-stream-perf
to
claude/compassionate-brahmagupta-94vewq
September 22, 2026 08:50
`isInnerSpec` keyed on `select` alone, so `$inner: { language: X }` — the
long form that `types.d.ts` documents a bare grammar reference as shorthand
for — was read as an inline grammar and crashed in `matchPattern`. Decide on
the key set instead, keeping the `select` type check so a one-token grammar
named `select` still works inline.
A selector naming no container (`''`, `' , '`, `[]`) silently disabled inner
highlighting. Throw instead, above the `!inner` early exit, so the same
malformed grammar fails the same way with or without an inner language.
Follow-up to #4110, whose code both bugs are in.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
DmitrySharabin
force-pushed
the
claude/inner-spec-detection
branch
from
September 22, 2026 09:06
6fe21cb to
0dbe335
Compare
DmitrySharabin
added this pull request to stack #4126
September 22, 2026 09:06
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix
$inner: { language: X }crashing with aTypeError, and emptyselectvalues silently disabling inner highlighting instead of failing loud.isInnerSpeckeyed onselectalone, so{ language: X }— the documented shorthand form — was read as an inline grammar. Decide on the key set instead, keeping theselecttype check so a one-token grammar namedselectstill works inline.select: '',' , ',[]now throw, hoisted above the!innerearly exit, so a malformed grammar fails the same way with or without an inner language.diff,latte,js-templates, and every templating language stay byte-identical.Not done: a misspelled selector name still fails silently. Rejecting one needs a static walk through nested grammars with nowhere to cache it, and a runtime check can't tell it apart from a selector that legitimately matches nothing (a diff with no deleted lines).
10233 passing / 1 pre-existing pending / 0 failing.
lint:ci,tsc, andtsc -p tests/tsconfig.jsonall clean.tests/core/registry.jssrc/core/tokenize/embed.js🤖 Generated with Claude Code