Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

languages: update templ #10114

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3196,7 +3196,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"
Expand Down
55 changes: 7 additions & 48 deletions runtime/queries/templ/highlights.scm
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
Expand All @@ -56,36 +39,12 @@
] @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)
Expand Down
Loading