You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Editor: highlighting disagrees with the parser on nameless timers, mid-line comments and escapes #664
The editor's Cooklang mode (static/js/src/cooklang-mode.js, added in 42bcebb / #246) still highlights a few constructs differently from how cooklang 0.19 parses them. #663 fixes the block-comment closer (#494) and gives quantities a highlight tag (#495), but these remain:
Text
Parser (cook recipe -f json)
Editor
Stir-fry for ~{1%minute} (in seed/Thai Green Curry.cook, seed/lamb-chops.cook)
timer, quantity 1, unit minute
~{ is the timer token, so 1 and minute get no colour; the new cm-cook-quantity from #663 never applies to nameless timers
Add @oil. -- careful [- not a block
-- is a line comment anywhere on a line (lexer line_comment)
-- is a comment only at the start of a line; the [- opens a block comment and every following line is shown as a comment
Season \[- not a comment
\ escapes the next character
the [- opens a block comment for the rest of the file
@salt -- or {3} / @pepper [- or {more} -] to taste
ingredient salt / pepper without a quantity, the rest is a comment
the name regex runs through the comment opener, so the comment is shown as part of the name and {3} / {more} as a quantity
Also:
state.position is never set to "timer", so the two "timer" checks in the brace handling are dead code.
cooklang-mode.js now imports Tag from @lezer/highlight (and editor.js already imported tags), but package.json doesn't declare it; it only arrives through @codemirror/language, whose range (^1.0.0) allows versions without Tag.define(name).
🤖 Analysis made by Claude (Anthropic's AI assistant), posted on behalf of @LeMyst.
Activity
fix(editor): highlight nameless timers, mid-line comments and escapes…