mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-11 16:00:02 -04:00
Add RsHtml template language support
This commit is contained in:
parent
5eca61b32a
commit
7515c33d15
4 changed files with 132 additions and 0 deletions
114
runtime/queries/rshtml/highlights.scm
Normal file
114
runtime/queries/rshtml/highlights.scm
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
(start_symbol) @keyword
|
||||
|
||||
(hash_symbol) @punctuation.special
|
||||
|
||||
(open_paren) @punctuation.bracket
|
||||
|
||||
(close_paren) @punctuation.bracket
|
||||
|
||||
(open_brace) @punctuation.bracket
|
||||
|
||||
(close_brace) @punctuation.bracket
|
||||
|
||||
(fat_arrow) @operator
|
||||
|
||||
(semicolon) @punctuation.delimiter
|
||||
|
||||
(equals) @punctuation.delimiter
|
||||
|
||||
(string_line) @string
|
||||
|
||||
(comment_block) @comment
|
||||
|
||||
(open_comment) @operator
|
||||
|
||||
(close_comment) @operator
|
||||
|
||||
(continue_) @keyword.conditional
|
||||
|
||||
(break_) @keyword.conditional
|
||||
|
||||
((start_symbol) @keyword.import
|
||||
.
|
||||
(extends_) @keyword.import)
|
||||
|
||||
(raw_) @keyword
|
||||
|
||||
((start_symbol) @keyword.import
|
||||
.
|
||||
(include_directive
|
||||
(include_) @keyword.import))
|
||||
|
||||
(render_) @keyword
|
||||
|
||||
(render_body_) @keyword
|
||||
|
||||
(child_content_) @keyword
|
||||
|
||||
(section_) @keyword
|
||||
|
||||
(section_block
|
||||
name: (rust_identifier) @module)
|
||||
|
||||
(as_) @keyword.operator
|
||||
|
||||
(as_clause
|
||||
alias: (rust_identifier) @type)
|
||||
|
||||
((start_symbol) @keyword.import
|
||||
.
|
||||
(use_directive
|
||||
(use_) @keyword.import))
|
||||
|
||||
(number) @number
|
||||
|
||||
(bool) @boolean
|
||||
|
||||
(tag_open) @punctuation.bracket
|
||||
|
||||
(tag_close) @punctuation.bracket
|
||||
|
||||
(tag_end_open) @punctuation.bracket
|
||||
|
||||
(tag_self_close) @punctuation.bracket
|
||||
|
||||
(component_tag
|
||||
name: (component_tag_identifier) @tag)
|
||||
|
||||
(component_tag
|
||||
name_close: (component_tag_identifier) @tag)
|
||||
|
||||
(component_tag_parameter
|
||||
name: (rust_identifier) @variable.parameter)
|
||||
|
||||
((start_symbol) @function.call
|
||||
.
|
||||
(rust_expr_simple))
|
||||
|
||||
((start_symbol) @function.call
|
||||
.
|
||||
(rust_expr_paren))
|
||||
|
||||
((start_symbol) @keyword.directive
|
||||
.
|
||||
(rust_block))
|
||||
|
||||
((start_symbol) @keyword.conditional
|
||||
.
|
||||
(if_stmt))
|
||||
|
||||
((start_symbol) @keyword
|
||||
.
|
||||
(for_stmt))
|
||||
|
||||
((start_symbol) @keyword.repeat
|
||||
.
|
||||
(while_stmt))
|
||||
|
||||
((start_symbol) @keyword.conditional
|
||||
.
|
||||
(match_stmt))
|
||||
|
||||
;this is for now extra
|
||||
(else_clause
|
||||
head: (rust_text) @keyword.conditional)
|
||||
9
runtime/queries/rshtml/injections.scm
Normal file
9
runtime/queries/rshtml/injections.scm
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
((html_text) @injection.content
|
||||
(#set! injection.language "html")
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.combined))
|
||||
|
||||
((rust_text) @injection.content
|
||||
(#set! injection.language "rust")
|
||||
(#set! injection.include-children)
|
||||
(#not-match? @injection.content "^else"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue