forked from Mirrors/helix
feat(tree-sitter): ✨ add go template support (#3091)
* feat(tree-sitter): ✨ add go template support * fix(tree-sitter): 🐛 go template highlight scope selectors * chore(tree-sitter): 🔧 update go template grammar commitimgbot
parent
d4a5413255
commit
2ede98c4b4
@ -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
|
@ -0,0 +1,2 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
Loading…
Reference in New Issue