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