diff options
author | Daniel Longeuay | 2022-07-26 01:17:28 +0000 |
---|---|---|
committer | GitHub | 2022-07-26 01:17:28 +0000 |
commit | 2ede98c4b4275cc2176836347b7c921a7f018d72 (patch) | |
tree | e47baf0dc0cba24b696a11c85f5ce983abe3626b /runtime/queries | |
parent | d4a5413255670ce30a0d91192ed375be8cd890a6 (diff) |
feat(tree-sitter): :sparkles: add go template support (#3091)
* feat(tree-sitter): :sparkles: add go template support
* fix(tree-sitter): :bug: go template highlight scope selectors
* chore(tree-sitter): :wrench: update go template grammar commit
Diffstat (limited to 'runtime/queries')
-rw-r--r-- | runtime/queries/gotmpl/highlights.scm | 76 | ||||
-rw-r--r-- | runtime/queries/gotmpl/injections.scm | 2 |
2 files changed, 78 insertions, 0 deletions
diff --git a/runtime/queries/gotmpl/highlights.scm b/runtime/queries/gotmpl/highlights.scm new file mode 100644 index 00000000..5921d161 --- /dev/null +++ b/runtime/queries/gotmpl/highlights.scm @@ -0,0 +1,76 @@ +; Identifiers + +[ + (field) + (field_identifier) +] @variable.other.member + +(variable) @variable + +; Function calls + +(function_call + function: (identifier) @function) + +(method_call + method: (selector_expression + field: (field_identifier) @function)) + +; Operators + +"|" @operator +":=" @operator + +; Builtin functions + +((identifier) @function.builtin + (#match? @function.builtin "^(and|call|html|index|slice|js|len|not|or|print|printf|println|urlquery|eq|ne|lt|ge|gt|ge)$")) + +; Delimiters + +"." @punctuation.delimiter +"," @punctuation.delimiter + +"{{" @punctuation.bracket +"}}" @punctuation.bracket +"{{-" @punctuation.bracket +"-}}" @punctuation.bracket +")" @punctuation.bracket +"(" @punctuation.bracket + +; Keywords + +"else" @keyword +"if" @keyword +"range" @keyword +"with" @keyword +"end" @keyword +"template" @keyword +"define" @keyword +"block" @keyword + +; Literals + +[ + (interpreted_string_literal) + (raw_string_literal) + (rune_literal) +] @string + +(escape_sequence) @string.special + +[ + (int_literal) + (float_literal) + (imaginary_literal) +] @constant.numeric.integer + +[ + (true) + (false) +] @constant.builtin.boolean + +(nil) @constant.builtin + +(comment) @comment +(ERROR) @error diff --git a/runtime/queries/gotmpl/injections.scm b/runtime/queries/gotmpl/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/gotmpl/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) |