mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 03:10:04 -04:00
style(typst): format queries
This commit is contained in:
parent
06d575ead4
commit
f85b205e83
2 changed files with 77 additions and 62 deletions
|
|
@ -1,114 +1,131 @@
|
||||||
;; comments
|
; comments
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
;; punctuation
|
; punctuation
|
||||||
|
"#" @punctuation.special
|
||||||
|
|
||||||
[
|
[
|
||||||
"#"
|
":"
|
||||||
] @punctuation.special
|
";"
|
||||||
|
","
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[
|
[
|
||||||
":"
|
"("
|
||||||
";"
|
")"
|
||||||
","
|
"{"
|
||||||
] @punctuation.delimiter
|
"}"
|
||||||
[
|
] @punctuation.bracket
|
||||||
"(" ")"
|
|
||||||
"{" "}"
|
|
||||||
] @punctuation.bracket
|
|
||||||
; TODO: context blocks?
|
; TODO: context blocks?
|
||||||
[
|
[
|
||||||
"["
|
"["
|
||||||
"]"
|
"]"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
;; operators
|
; operators
|
||||||
[
|
[
|
||||||
"-"
|
"-"
|
||||||
"+"
|
"+"
|
||||||
"*"
|
"*"
|
||||||
"/"
|
"/"
|
||||||
|
"=="
|
||||||
|
"!="
|
||||||
|
"<"
|
||||||
|
"<="
|
||||||
|
">"
|
||||||
|
">="
|
||||||
|
"="
|
||||||
|
"in"
|
||||||
|
"and"
|
||||||
|
"or"
|
||||||
|
"not"
|
||||||
|
] @operator
|
||||||
|
|
||||||
"=="
|
; keywords
|
||||||
"!="
|
|
||||||
"<"
|
|
||||||
"<="
|
|
||||||
">"
|
|
||||||
">="
|
|
||||||
|
|
||||||
"="
|
|
||||||
|
|
||||||
"in"
|
|
||||||
"and"
|
|
||||||
"or"
|
|
||||||
"not"
|
|
||||||
] @operator
|
|
||||||
|
|
||||||
;; keywords
|
|
||||||
[
|
[
|
||||||
"import"
|
"import"
|
||||||
"include"
|
"include"
|
||||||
] @keyword.import
|
] @keyword.import
|
||||||
[
|
|
||||||
"let"
|
|
||||||
"set"
|
|
||||||
"show"
|
|
||||||
] @keyword
|
|
||||||
|
|
||||||
;; control flow
|
[
|
||||||
|
"let"
|
||||||
|
"set"
|
||||||
|
"show"
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
; control flow
|
||||||
[
|
[
|
||||||
"for"
|
"for"
|
||||||
"while"
|
"while"
|
||||||
"break"
|
"break"
|
||||||
"continue"
|
"continue"
|
||||||
] @keyword.repeat
|
] @keyword.repeat
|
||||||
|
|
||||||
[
|
[
|
||||||
"if"
|
"if"
|
||||||
"else"
|
"else"
|
||||||
] @keyword.conditional
|
] @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
|
(number) @number
|
||||||
|
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
(bool) @boolean
|
(bool) @boolean
|
||||||
|
|
||||||
;; identifiers
|
; identifiers
|
||||||
(builtin) @module.builtin
|
(builtin) @module.builtin
|
||||||
|
|
||||||
(ident) @constant
|
(ident) @constant
|
||||||
|
|
||||||
;; name-value pairs
|
; name-value pairs
|
||||||
(tagged
|
(tagged
|
||||||
field: (ident)) @variable.member
|
field: (ident)) @variable.member
|
||||||
;; function definitions, calls, etc.
|
|
||||||
;; TODO: support for functions such as #calc.cos, tree view appears as
|
; function definitions, calls, etc.
|
||||||
;; (call)
|
; TODO: support for functions such as #calc.cos, tree view appears as
|
||||||
;; item: (field)
|
; (call)
|
||||||
;; (builtin)
|
; item: (field)
|
||||||
|
; (builtin)
|
||||||
; field: (ident)
|
; field: (ident)
|
||||||
(call
|
(call
|
||||||
item: (builtin) @function.builtin)
|
item: (builtin) @function.builtin)
|
||||||
|
|
||||||
(call
|
(call
|
||||||
item: (ident) @function.call)
|
item: (ident) @function.call)
|
||||||
|
|
||||||
;; text
|
; text
|
||||||
(text) @spell
|
(text) @spell
|
||||||
|
|
||||||
; TODO: use multi level headings
|
; TODO: use multi level headings
|
||||||
(heading) @markup.heading
|
(heading) @markup.heading
|
||||||
|
|
||||||
(strong) @markup.strong
|
(strong) @markup.strong
|
||||||
|
|
||||||
(emph) @markup.italic
|
(emph) @markup.italic
|
||||||
|
|
||||||
(url) @markup.link.url
|
(url) @markup.link.url
|
||||||
|
|
||||||
;; code blocks
|
; code blocks
|
||||||
(raw_span) @markup.raw
|
(raw_span) @markup.raw
|
||||||
|
|
||||||
(raw_span
|
(raw_span
|
||||||
(blob)) @markup.raw
|
(blob)) @markup.raw
|
||||||
|
|
||||||
(raw_blck) @markup.raw
|
(raw_blck) @markup.raw
|
||||||
|
|
||||||
(raw_blck
|
(raw_blck
|
||||||
(blob)) @markup.raw.block
|
(blob)) @markup.raw.block
|
||||||
|
|
||||||
;; refs and labels
|
; refs and labels
|
||||||
(label) @markup.link.label
|
(label) @markup.link.label
|
||||||
|
|
||||||
(ref) @markup.link
|
(ref) @markup.link
|
||||||
|
|
||||||
;; math
|
; math
|
||||||
(math) @markup.math
|
(math) @markup.math
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,2 @@
|
||||||
([
|
((comment) @injection.content
|
||||||
(comment)
|
|
||||||
] @injection.content
|
|
||||||
(#set! injection.language "comment"))
|
(#set! injection.language "comment"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue