From f85b205e83750af4fd926c6874dfe256e3fa4fb5 Mon Sep 17 00:00:00 2001 From: Raafat Turki Date: Fri, 16 Feb 2024 22:30:48 +0300 Subject: [PATCH] style(typst): format queries --- queries/typst/highlights.scm | 135 ++++++++++++++++++++--------------- queries/typst/injections.scm | 4 +- 2 files changed, 77 insertions(+), 62 deletions(-) diff --git a/queries/typst/highlights.scm b/queries/typst/highlights.scm index 84d751b7d..f6164ca6f 100644 --- a/queries/typst/highlights.scm +++ b/queries/typst/highlights.scm @@ -1,114 +1,131 @@ -;; comments +; comments (comment) @comment @spell -;; punctuation +; punctuation +"#" @punctuation.special + [ - "#" - ] @punctuation.special + ":" + ";" + "," +] @punctuation.delimiter + [ - ":" - ";" - "," - ] @punctuation.delimiter -[ - "(" ")" - "{" "}" - ] @punctuation.bracket + "(" + ")" + "{" + "}" +] @punctuation.bracket + ; TODO: context blocks? [ - "[" - "]" - ] @punctuation.bracket + "[" + "]" +] @punctuation.bracket -;; operators +; operators [ - "-" - "+" - "*" - "/" + "-" + "+" + "*" + "/" + "==" + "!=" + "<" + "<=" + ">" + ">=" + "=" + "in" + "and" + "or" + "not" +] @operator - "==" - "!=" - "<" - "<=" - ">" - ">=" - - "=" - - "in" - "and" - "or" - "not" - ] @operator - -;; keywords +; keywords [ - "import" - "include" - ] @keyword.import -[ - "let" - "set" - "show" - ] @keyword + "import" + "include" +] @keyword.import -;; control flow +[ + "let" + "set" + "show" +] @keyword + +; control flow [ "for" "while" "break" "continue" ] @keyword.repeat + [ "if" "else" ] @keyword.conditional -; special case: #for (ident) in (expr) -(for "in" @keyword.repeat) -;; type literals +; special case: #for (ident) in (expr) +(for + "in" @keyword.repeat) + +; type literals (number) @number + (string) @string + (bool) @boolean -;; identifiers +; identifiers (builtin) @module.builtin + (ident) @constant -;; name-value pairs +; name-value pairs (tagged field: (ident)) @variable.member -;; function definitions, calls, etc. -;; TODO: support for functions such as #calc.cos, tree view appears as -;; (call) -;; item: (field) -;; (builtin) + +; function definitions, calls, etc. +; TODO: support for functions such as #calc.cos, tree view appears as +; (call) +; item: (field) +; (builtin) ; field: (ident) (call item: (builtin) @function.builtin) + (call item: (ident) @function.call) -;; text +; text (text) @spell + ; TODO: use multi level headings (heading) @markup.heading + (strong) @markup.strong + (emph) @markup.italic + (url) @markup.link.url -;; code blocks +; code blocks (raw_span) @markup.raw + (raw_span (blob)) @markup.raw + (raw_blck) @markup.raw + (raw_blck (blob)) @markup.raw.block -;; refs and labels +; refs and labels (label) @markup.link.label + (ref) @markup.link -;; math +; math (math) @markup.math diff --git a/queries/typst/injections.scm b/queries/typst/injections.scm index 050826330..2f0e58eb6 100644 --- a/queries/typst/injections.scm +++ b/queries/typst/injections.scm @@ -1,4 +1,2 @@ -([ - (comment) -] @injection.content +((comment) @injection.content (#set! injection.language "comment"))