From 019b4041a848061cbb04bc4dab495747f45e63e5 Mon Sep 17 00:00:00 2001 From: claude Date: Tue, 9 Jun 2026 07:28:43 +0000 Subject: [PATCH] fix(typst): highlight function names across newlines in code args 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 --- .../js/features/source-editor/lezer-typst/tokens.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/web/frontend/js/features/source-editor/lezer-typst/tokens.mjs b/services/web/frontend/js/features/source-editor/lezer-typst/tokens.mjs index e3a5f1436f..54d6b26668 100644 --- a/services/web/frontend/js/features/source-editor/lezer-typst/tokens.mjs +++ b/services/web/frontend/js/features/source-editor/lezer-typst/tokens.mjs @@ -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