From e9cc63a261785e9cddd1dd214a66978f6423f22e Mon Sep 17 00:00:00 2001 From: claude Date: Mon, 8 Jun 2026 08:40:28 +0000 Subject: [PATCH] typst: highlight function name after #set / #show keywords KeywordExpr now optionally includes a CallExpr, so '#set text(size: 12pt)' parses 'text' as a CallExpr/CodeIdent and gets the function-name highlight colour. The optional CallExpr only shifts when the lookahead is CodeIdent, so there is no shift/reduce conflict with other items. Co-Authored-By: Claude Sonnet 4.6 --- .../js/features/source-editor/lezer-typst/typst.grammar | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/features/source-editor/lezer-typst/typst.grammar b/services/web/frontend/js/features/source-editor/lezer-typst/typst.grammar index 7404ac9b00..f7e05a5ba3 100644 --- a/services/web/frontend/js/features/source-editor/lezer-typst/typst.grammar +++ b/services/web/frontend/js/features/source-editor/lezer-typst/typst.grammar @@ -67,7 +67,10 @@ codeExprBody { ContentBlock } -KeywordExpr { CodeKeyword } +// CallExpr? covers '#set text(size: 12pt)', '#show heading: ...', etc. +// The optional CallExpr is only shifted when the next token is CodeIdent, +// so there is no shift/reduce conflict with other items that follow keywords. +KeywordExpr { CodeKeyword CallExpr? } AtomExpr { CodeBool } CallExpr { CodeIdent callSuffix* }