Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/templ/highlights.scm')
-rw-r--r--runtime/queries/templ/highlights.scm55
1 files changed, 48 insertions, 7 deletions
diff --git a/runtime/queries/templ/highlights.scm b/runtime/queries/templ/highlights.scm
index d015970c..e5b2ede0 100644
--- a/runtime/queries/templ/highlights.scm
+++ b/runtime/queries/templ/highlights.scm
@@ -1,9 +1,28 @@
-; inherits: go
+(package_identifier) @namespace
-(css_declaration
- name: (css_identifier) @function)
-(script_declaration
- name: (script_identifier) @function)
+(parameter_declaration (identifier) @variable.parameter)
+(variadic_parameter_declaration (identifier) @variable.parameter)
+
+(function_declaration
+ name: (identifier) @function)
+
+(type_spec name: (type_identifier) @type)
+(type_identifier) @type
+(field_identifier) @variable.other.member
+(identifier) @variable
+
+; Function calls
+
+(call_expression
+ function: (identifier) @function)
+
+(call_expression
+ function: (selector_expression
+ field: (field_identifier) @function))
+
+;
+; These are Templ specific
+;
(component_declaration
name: (component_identifier) @function)
@@ -23,8 +42,6 @@
(css_property
name: (css_property_name) @attribute)
-(css_property
- value: (css_property_value) @constant)
(expression) @function.method
(dynamic_class_attribute_value) @function.method
@@ -39,13 +56,37 @@
] @operator
[
+ "func"
+ "var"
+ "const"
"templ"
"css"
"type"
+ "struct"
+ "range"
"script"
] @keyword.storage.type
[
+ "return"
+] @keyword.control.return
+
+[
+ "import"
+ "package"
+] @keyword.control.import
+
+[
+ "else"
+ "case"
+ "switch"
+ "if"
+ "default"
+] @keyword.control.conditional
+
+"for" @keyword.control.repeat
+
+[
(interpreted_string_literal)
(raw_string_literal)
(rune_literal)