diff options
author | Alexander Brevig | 2023-10-26 23:27:42 +0000 |
---|---|---|
committer | GitHub | 2023-10-26 23:27:42 +0000 |
commit | 290666011971c79e36b5172eea66b315dc52e2c9 (patch) | |
tree | 328e9b8562a8dd916214545a9b89ba1f55cb8670 /runtime/queries | |
parent | ef1f4f31b6e0d8338a9f5b8932de9b07ac7bb0a0 (diff) |
Add typst language and lsp (#7474)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Diffstat (limited to 'runtime/queries')
-rw-r--r-- | runtime/queries/typst/highlights.scm | 77 | ||||
-rw-r--r-- | runtime/queries/typst/injections.scm | 6 |
2 files changed, 83 insertions, 0 deletions
diff --git a/runtime/queries/typst/highlights.scm b/runtime/queries/typst/highlights.scm new file mode 100644 index 00000000..b422e05b --- /dev/null +++ b/runtime/queries/typst/highlights.scm @@ -0,0 +1,77 @@ +(call + item: (ident) @function) +(call + item: (field field: (ident) @function.method)) +(tagged field: (ident) @tag) +(field field: (ident) @tag) +(comment) @comment + +; CONTROL +(let "let" @keyword.storage.type) +(branch ["if" "else"] @keyword.control.conditional) +(while "while" @keyword.control.repeat) +(for ["for" "in"] @keyword.control.repeat) +(import "import" @keyword.control.import) +(as "as" @keyword.operator) +(include "include" @keyword.control.import) +(show "show" @keyword.control) +(set "set" @keyword.control) +(return "return" @keyword.control) +(flow ["break" "continue"] @keyword.control) + +; OPERATOR +(in ["in" "not"] @keyword.operator) +(and "and" @keyword.operator) +(or "or" @keyword.operator) +(not "not" @keyword.operator) +(sign ["+" "-"] @operator) +(add "+" @operator) +(sub "-" @operator) +(mul "*" @operator) +(div "/" @operator) +(cmp ["==" "<=" ">=" "!=" "<" ">"] @operator) +(fraction "/" @operator) +(fac "!" @operator) +(attach ["^" "_"] @operator) +(wildcard) @operator + +; VALUE +(raw_blck "```" @operator) @markup.raw.block +(raw_span "`" @operator) @markup.raw.block +(raw_blck lang: (ident) @tag) +(label) @tag +(ref) @tag +(number) @constant.numeric +(string) @string +(content ["[" "]"] @operator) +(bool) @constant.builtin.boolean +(builtin) @constant.builtin +(none) @constant.builtin +(auto) @constant.builtin +(ident) @variable +(call + item: (builtin) @function.builtin) + +; MARKUP +(item "-" @markup.list) +(term ["/" ":"] @markup.list) +(heading ["=" "==" "===" "====" "====="] @markup.heading.marker) @markup.heading +(url) @tag +(emph) @markup.italic +(strong) @markup.bold +(symbol) @constant.character +(shorthand) @constant.builtin +(quote) @markup.quote +(align) @operator +(letter) @constant.character +(linebreak) @constant.builtin + +(math "$" @operator) +"#" @operator +"end" @operator + +(escape) @constant.character.escape +["(" ")" "{" "}"] @punctuation.bracket +["," ";" ".." ":" "sep"] @punctuation.delimiter +"assign" @punctuation +(field "." @punctuation) diff --git a/runtime/queries/typst/injections.scm b/runtime/queries/typst/injections.scm new file mode 100644 index 00000000..8039b4ca --- /dev/null +++ b/runtime/queries/typst/injections.scm @@ -0,0 +1,6 @@ +(raw_blck + (blob) @injection.shebang @injection.content) + +(raw_blck + lang: (ident) @injection.language + (blob) @injection.content)
\ No newline at end of file |