-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 commit
- Loading branch information
1 parent
d4a5413
commit 2ede98c
Showing
4 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
((comment) @injection.content | ||
(#set! injection.language "comment")) |