-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
queries: update with the latest files from nvim-treesitter
Forgot to update the files after tree-sitter-templ was included in nvim-treesitter
- Loading branch information
1 parent
d7d19f1
commit f9c60b5
Showing
2 changed files
with
33 additions
and
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,105 +1,49 @@ | ||
; TODO(vincent): can we use injection ? I can't get it working | ||
|
||
; A bunch of these are taken from: | ||
; * https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/go/highlights.scm | ||
; * https://github.com/tree-sitter/tree-sitter-go/blob/master/queries/highlights.scm | ||
|
||
(package_identifier) @namespace | ||
|
||
(parameter_declaration (identifier) @parameter) | ||
(variadic_parameter_declaration (identifier) @parameter) | ||
|
||
(function_declaration | ||
name: (identifier) @function) | ||
|
||
(type_spec name: (type_identifier) @type.definition) | ||
(type_identifier) @type | ||
(field_identifier) @property | ||
(identifier) @variable | ||
|
||
; Function calls | ||
|
||
(call_expression | ||
function: (identifier) @function.call) | ||
|
||
(call_expression | ||
function: (selector_expression | ||
field: (field_identifier) @method.call)) | ||
|
||
; | ||
; These are Templ specific | ||
; | ||
|
||
; inherits: go | ||
(component_declaration | ||
name: (component_identifier) @function) | ||
|
||
(tag_start) @tag | ||
(tag_end) @tag | ||
(self_closing_tag) @tag | ||
(style_element) @tag | ||
[ | ||
(tag_start) | ||
(tag_end) | ||
(self_closing_tag) | ||
(style_element) | ||
] @tag | ||
|
||
(attribute | ||
name: (attribute_name) @tag.attribute) | ||
|
||
(attribute | ||
value: (quoted_attribute_value) @string) | ||
|
||
(element_text) @string.special | ||
(style_element_text) @string.special | ||
[ | ||
(element_text) | ||
(style_element_text) | ||
] @string.special | ||
|
||
(css_identifier) @function | ||
|
||
(css_property | ||
name: (css_property_name) @attribute) | ||
name: (css_property_name) @property) | ||
|
||
(css_property | ||
value: (css_property_value) @string) | ||
|
||
(expression) @function.method | ||
(dynamic_class_attribute_value) @function.method | ||
[ | ||
(expression) | ||
(dynamic_class_attribute_value) | ||
] @function.method | ||
|
||
(component_import | ||
name: (component_identifier) @function) | ||
|
||
(component_render) @function.call | ||
|
||
[ | ||
"@" | ||
] @operator | ||
(element_comment) @comment @spell | ||
|
||
"@" @operator | ||
|
||
[ | ||
"func" | ||
"var" | ||
"const" | ||
"templ" | ||
"css" | ||
"type" | ||
"return" | ||
"struct" | ||
"range" | ||
"script" | ||
] @keyword | ||
|
||
[ | ||
"import" | ||
"package" | ||
] @include | ||
|
||
[ | ||
"else" | ||
"case" | ||
"switch" | ||
"if" | ||
"default" | ||
] @conditional | ||
|
||
"for" @repeat | ||
|
||
[ | ||
(interpreted_string_literal) | ||
(raw_string_literal) | ||
(rune_literal) | ||
] @string | ||
|
||
; Comments | ||
|
||
(comment) @comment @spell | ||
|
||
(element_comment) @comment @spell |
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 |
---|---|---|
@@ -1,4 +1,12 @@ | ||
((script_block_text) @injection.content (#set! injection.language "javascript")) | ||
((script_element_text) @injection.content (#set! injection.language "javascript")) | ||
; inherits: go | ||
((element_comment) @injection.content | ||
(#set! injection.language "comment")) | ||
|
||
((style_element_text) @injection.content (#set! injection.language "css")) | ||
((script_block_text) @injection.content | ||
(#set! injection.language "javascript")) | ||
|
||
((script_element_text) @injection.content | ||
(#set! injection.language "javascript")) | ||
|
||
((style_element_text) @injection.content | ||
(#set! injection.language "css")) |