fix(typst): highlight function names across newlines in code args
Build and Deploy Verso / deploy (push) Successful in 9m35s

codeIdentTokenizer's backward scan stopped at \n, so identifiers at the
start of a new indented line inside multi-line arg lists (e.g. image(),
table() inside #figure(...)) never matched the '(' guard and stayed black.
Extend the whitespace skip to also cross newlines.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
claude
2026-06-09 07:28:43 +00:00
parent 4aca4aaac6
commit 019b4041a8
@@ -321,10 +321,10 @@ export const codeIdentTokenizer = new ExternalTokenizer(
if (!stack.canShift(CodeIdent)) return
// Guard: only fire in code context.
// Walk back past any horizontal whitespace (@skip) to the nearest
// non-space character and check that it is a code-mode delimiter.
// Walk back past whitespace (including newlines inside multi-line arg lists)
// to the nearest non-space character and check that it is a code-mode delimiter.
let back = -1
while (input.peek(back) === SPACE || input.peek(back) === TAB) back--
while (input.peek(back) === SPACE || input.peek(back) === TAB || input.peek(back) === NEWLINE) back--
const prev = input.peek(back)
if (prev !== HASH && prev !== DOT && prev !== OPEN_PAREN && prev !== COMMA) return