diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2023-06-12 09:54:30 -0600 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2025-05-12 18:43:40 +0200 |
| commit | 692b051b09935653befdb8f7ba8afdb640adf17b (patch) | |
| tree | 167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/typst | |
| parent | feat(c-family): inherit injections (diff) | |
| download | nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2 nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip | |
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/typst')
| -rw-r--r-- | runtime/queries/typst/folds.scm | 11 | ||||
| -rw-r--r-- | runtime/queries/typst/highlights.scm | 131 | ||||
| -rw-r--r-- | runtime/queries/typst/indents.scm | 12 | ||||
| -rw-r--r-- | runtime/queries/typst/injections.scm | 2 |
4 files changed, 156 insertions, 0 deletions
diff --git a/runtime/queries/typst/folds.scm b/runtime/queries/typst/folds.scm new file mode 100644 index 000000000..ef0ec7956 --- /dev/null +++ b/runtime/queries/typst/folds.scm @@ -0,0 +1,11 @@ +[ + (set) + (let) + (show) + (call) + (section) + (for) + (branch) + (content) + (raw_blck) +] @fold diff --git a/runtime/queries/typst/highlights.scm b/runtime/queries/typst/highlights.scm new file mode 100644 index 000000000..a0dcc1b89 --- /dev/null +++ b/runtime/queries/typst/highlights.scm @@ -0,0 +1,131 @@ +; punctuation +"#" @punctuation.special + +[ + ":" + ";" + "," +] @punctuation.delimiter + +; TODO: context blocks for "[" "]"? +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket + +; operators +[ + "-" + "+" + "*" + "/" + "==" + "!=" + "<" + "<=" + ">" + ">=" + "=" + "in" + "and" + "or" + "not" +] @operator + +; keywords +[ + "import" + "include" +] @keyword.import + +[ + "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 +(number) @number + +(string) @string + +(bool) @boolean + +(ident) @constant + +; name-value pairs +(tagged + field: (ident) @variable.member) + +(call + item: (ident) @function.call) + +; text +(text) @spell + +(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 + +(strong) @markup.strong + +(emph) @markup.italic + +(url) @markup.link.url + +; code blocks +(raw_span) @markup.raw + +(raw_blck) @markup.raw + +(raw_blck + lang: (ident) @label) + +(raw_blck + (blob) @markup.raw.block) + +; refs and labels +(label) @markup.link.label + +(ref) @markup.link + +; math +(math) @markup.math + +; comments +(comment) @comment @spell diff --git a/runtime/queries/typst/indents.scm b/runtime/queries/typst/indents.scm new file mode 100644 index 000000000..d43c586c1 --- /dev/null +++ b/runtime/queries/typst/indents.scm @@ -0,0 +1,12 @@ +[ + (set) + (let) + (show) + (call) +] @indent.begin + +[ + "]" + "}" + ")" +] @indent.branch @indent.end diff --git a/runtime/queries/typst/injections.scm b/runtime/queries/typst/injections.scm new file mode 100644 index 000000000..2f0e58eb6 --- /dev/null +++ b/runtime/queries/typst/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) |
