diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 95510e5af..caab97b47 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -250,6 +250,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | @steelsojka [robots](https://github.com/opa-oz/tree-sitter-robots-txt) | unstable | `H  J ` | @opa-oz [roc](https://github.com/faldor20/tree-sitter-roc) | unstable | `H IJL` | @nat-418 [ron](https://github.com/tree-sitter-grammars/tree-sitter-ron) | unstable | `HFIJL` | @amaanq +[rshtml](https://github.com/rshtml/tree-sitter-rshtml) | unstable | `H  J ` | @rshtml [rst](https://github.com/stsewd/tree-sitter-rst) | unstable | `H  JL` | @stsewd [ruby](https://github.com/tree-sitter/tree-sitter-ruby) | unstable | `HFIJL` | @TravonteD [runescript](https://github.com/2004Scape/tree-sitter-runescript) | unstable | `H  J ` | @2004Scape diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 883403fd6..07083f1d6 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1963,6 +1963,14 @@ return { maintainers = { '@amaanq' }, tier = 2, }, + rshtml = { + install_info = { + revision = '89ae0f3a5e221a83aad243def85e822616d3b3c2', + url = 'https://github.com/rshtml/tree-sitter-rshtml', + }, + maintainers = { '@rshtml' }, + tier = 2, + }, rst = { install_info = { revision = '4e562e1598b95b93db4f3f64fe40ddefbc677a15', diff --git a/runtime/queries/rshtml/highlights.scm b/runtime/queries/rshtml/highlights.scm new file mode 100644 index 000000000..af1090140 --- /dev/null +++ b/runtime/queries/rshtml/highlights.scm @@ -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) diff --git a/runtime/queries/rshtml/injections.scm b/runtime/queries/rshtml/injections.scm new file mode 100644 index 000000000..47752078e --- /dev/null +++ b/runtime/queries/rshtml/injections.scm @@ -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"))