Unnamed repository; edit this file 'description' to name the repository.
languages: update templ (#10114)
Angus Dippenaar 2024-04-03
parent 226b275 · commit e0ec344
-rw-r--r--languages.toml2
-rw-r--r--runtime/queries/templ/highlights.scm55
2 files changed, 8 insertions, 49 deletions
diff --git a/languages.toml b/languages.toml
index 8b7c43a7..bf6a4cf4 100644
--- a/languages.toml
+++ b/languages.toml
@@ -3198,7 +3198,7 @@ language-servers = [ "templ" ]
[[grammar]]
name = "templ"
-source = { git = "https://github.com/vrischmann/tree-sitter-templ", rev = "ea56ac0655243490a4929a988f4eaa91dfccc995" }
+source = { git = "https://github.com/vrischmann/tree-sitter-templ", rev = "db662414ccd6f7c78b1e834e7abe11c224b04759" }
[[language]]
name = "dbml"
diff --git a/runtime/queries/templ/highlights.scm b/runtime/queries/templ/highlights.scm
index e5b2ede0..d015970c 100644
--- a/runtime/queries/templ/highlights.scm
+++ b/runtime/queries/templ/highlights.scm
@@ -1,28 +1,9 @@
-(package_identifier) @namespace
+; inherits: go
-(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
-;
+(css_declaration
+ name: (css_identifier) @function)
+(script_declaration
+ name: (script_identifier) @function)
(component_declaration
name: (component_identifier) @function)
@@ -42,6 +23,8 @@
(css_property
name: (css_property_name) @attribute)
+(css_property
+ value: (css_property_value) @constant)
(expression) @function.method
(dynamic_class_attribute_value) @function.method
@@ -56,37 +39,13 @@
] @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)