fix(typst): highlight function names across newlines in code args
Build and Deploy Verso / deploy (push) Successful in 9m35s
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:
@@ -321,10 +321,10 @@ export const codeIdentTokenizer = new ExternalTokenizer(
|
|||||||
if (!stack.canShift(CodeIdent)) return
|
if (!stack.canShift(CodeIdent)) return
|
||||||
|
|
||||||
// Guard: only fire in code context.
|
// Guard: only fire in code context.
|
||||||
// Walk back past any horizontal whitespace (@skip) to the nearest
|
// Walk back past whitespace (including newlines inside multi-line arg lists)
|
||||||
// non-space character and check that it is a code-mode delimiter.
|
// to the nearest non-space character and check that it is a code-mode delimiter.
|
||||||
let back = -1
|
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)
|
const prev = input.peek(back)
|
||||||
if (prev !== HASH && prev !== DOT && prev !== OPEN_PAREN && prev !== COMMA) return
|
if (prev !== HASH && prev !== DOT && prev !== OPEN_PAREN && prev !== COMMA) return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user