nvim-treesitter/runtime/queries/typst/highlights.scm

142 lines
1.7 KiB
Scheme
Raw Permalink Normal View History

2024-02-16 22:30:48 +03:00
; punctuation
"#" @punctuation.special
2024-02-16 22:03:00 +03:00
[
2024-02-16 22:30:48 +03:00
":"
";"
","
] @punctuation.delimiter
; TODO: context blocks for "[" "]"?
2024-02-16 22:03:00 +03:00
[
2024-02-16 22:30:48 +03:00
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
2024-02-16 22:03:00 +03:00
2024-02-16 22:30:48 +03:00
; operators
2024-02-16 21:07:55 +03:00
[
2024-02-16 22:30:48 +03:00
"-"
"+"
"*"
"/"
"=="
"!="
"<"
"<="
">"
">="
"="
"in"
"and"
"or"
"not"
] @operator
; keywords
2024-02-16 22:03:00 +03:00
[
2024-02-16 22:30:48 +03:00
"import"
"include"
] @keyword.import
2024-02-16 22:03:00 +03:00
[
2024-02-16 22:30:48 +03:00
"let"
"set"
"show"
] @keyword
2024-02-16 22:03:00 +03:00
2024-02-16 22:30:48 +03:00
; control flow
2024-02-16 22:03:00 +03:00
[
"for"
"while"
"break"
"continue"
] @keyword.repeat
2024-02-16 22:30:48 +03:00
2024-02-16 22:03:00 +03:00
[
"if"
"else"
] @keyword.conditional
2024-02-16 22:30:48 +03:00
2024-02-16 22:03:00 +03:00
; special case: #for (ident) in (expr)
2024-02-16 22:30:48 +03:00
(for
"in" @keyword.repeat)
2024-02-16 22:03:00 +03:00
2024-02-16 22:30:48 +03:00
; type literals
2024-02-16 21:07:55 +03:00
(number) @number
2024-02-16 22:30:48 +03:00
2024-02-16 21:07:55 +03:00
(string) @string
2024-02-16 22:30:48 +03:00
2024-02-16 21:07:55 +03:00
(bool) @boolean
2024-02-16 22:03:00 +03:00
(ident) @constant
2024-02-16 22:30:48 +03:00
; name-value pairs
2024-02-16 21:07:55 +03:00
(tagged
field: (ident) @variable.member)
2024-02-16 22:30:48 +03:00
2024-02-16 21:07:55 +03:00
(call
item: (ident) @function.call)
2024-02-16 21:07:55 +03:00
2024-02-16 22:30:48 +03:00
; text
2024-02-16 22:03:00 +03:00
(text) @spell
2024-02-16 22:30:48 +03:00
(heading
"=" @markup.heading.1) @markup.heading.1
(heading
"==" @markup.heading.2) @markup.heading.2
(heading
"===" @markup.heading.3) @markup.heading.3
(heading
"====" @markup.heading.4) @markup.heading.4
(heading
"=====" @markup.heading.5) @markup.heading.5
(heading
"======" @markup.heading.6) @markup.heading.6
2024-02-16 22:30:48 +03:00
2024-02-16 22:03:00 +03:00
(strong) @markup.strong
2024-02-16 22:30:48 +03:00
2024-02-16 22:03:00 +03:00
(emph) @markup.italic
2024-02-16 22:30:48 +03:00
((url) @markup.link.url
(#set! @markup.link.url url @markup.link.url))
(call
item: (ident) @_link
(#eq? @_link "link")
(group
.
(string) @markup.link.url
(#offset! @markup.link.url 0 1 0 -1)
(#set! @markup.link.url url @markup.link.url)))
2024-02-16 22:03:00 +03:00
2024-02-16 22:30:48 +03:00
; code blocks
2024-02-16 22:03:00 +03:00
(raw_span) @markup.raw
2024-02-16 22:30:48 +03:00
2024-02-16 22:03:00 +03:00
(raw_blck) @markup.raw
2024-02-16 22:30:48 +03:00
(raw_blck
lang: (ident) @label)
2024-02-16 21:07:55 +03:00
(raw_blck
(blob) @markup.raw.block)
2024-02-16 22:03:00 +03:00
2024-02-16 22:30:48 +03:00
; refs and labels
2024-02-16 22:03:00 +03:00
(label) @markup.link.label
2024-02-16 22:30:48 +03:00
2024-02-16 22:03:00 +03:00
(ref) @markup.link
2024-02-16 21:07:55 +03:00
2024-02-16 22:30:48 +03:00
; math
2024-02-16 22:03:00 +03:00
(math) @markup.math
; comments
(comment) @comment @spell