Skip to content

Commit

Permalink
feat: add support for templ (#359)
Browse files Browse the repository at this point in the history
* add support for templ

* remove else if

* add templ to html like languages
  • Loading branch information
mike-jl authored Sep 6, 2024
1 parent 8265d53 commit f89858a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
38 changes: 38 additions & 0 deletions after/queries/templ/matchup.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
; inherits: quote

[
(component_if_statement)
(conditional_attribute_if_statement)
] @scope.if

; 'else'
("else" @mid.if.1)

; if
("if" @open.if)

; switch
(component_switch_statement "switch" @open.switch
(component_switch_expression_case "case" @mid.switch.1)
(component_switch_default_case "default" @mid.switch.2)) @scope.switch

[
(element)
(script_element)
] @scope.tag

(tag_start (element_identifier) @open.tag)
(tag_end
(element_identifier) @close.tag
(#offset! @close.tag 0 -1 0 0))

(style_element
(style_tag_start) @open.style
(#offset! @open.style 0 1 0 -1)
(style_tag_end) @close.style
(#offset! @close.style 0 1 0 -1)
) @scope.style

(self_closing_tag
(element_identifier) @open.selftag
"/>" @close.selftag) @scope.selftag
3 changes: 2 additions & 1 deletion autoload/matchup/quirks.vim
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ let s:htmllikeft = [
\ 'tidy', 'php', 'liquid', 'haml', 'tt2html',
\ 'html', 'xhtml', 'xml', 'jsp', 'htmldjango',
\ 'aspvbs', 'rmd', 'markdown', 'eruby', 'vue',
\ 'javascriptreact', 'typescriptreact', 'svelte'
\ 'javascriptreact', 'typescriptreact', 'svelte',
\ 'templ'
\]

" }}}1
Expand Down

0 comments on commit f89858a

Please sign in to comment.