diff options
| author | Tristan Knight <tris203@gmail.com> | 2025-02-01 19:06:26 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-01 20:06:26 +0100 |
| commit | 39bf51ff68800a78156258fd3beca81a87895103 (patch) | |
| tree | dcbd679e375be57368e2771faa7b370cf25b693b | |
| parent | bot(lockfile): update bash, desktop, haskell, julia, nix, objc, typst (diff) | |
| download | nvim-treesitter-39bf51ff68800a78156258fd3beca81a87895103.tar nvim-treesitter-39bf51ff68800a78156258fd3beca81a87895103.tar.gz nvim-treesitter-39bf51ff68800a78156258fd3beca81a87895103.tar.bz2 nvim-treesitter-39bf51ff68800a78156258fd3beca81a87895103.tar.lz nvim-treesitter-39bf51ff68800a78156258fd3beca81a87895103.tar.xz nvim-treesitter-39bf51ff68800a78156258fd3beca81a87895103.tar.zst nvim-treesitter-39bf51ff68800a78156258fd3beca81a87895103.zip | |
feat(razor): add parser and queries (#7545)
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | lockfile.json | 3 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 8 | ||||
| -rw-r--r-- | queries/razor/folds.scm | 14 | ||||
| -rw-r--r-- | queries/razor/highlights.scm | 58 | ||||
| -rw-r--r-- | queries/razor/injections.scm | 11 |
6 files changed, 95 insertions, 0 deletions
@@ -386,6 +386,7 @@ We are looking for maintainers to add more parsers and to write query files for - [ ] [racket](https://github.com/6cdh/tree-sitter-racket) - [x] [ralph](https://github.com/alephium/tree-sitter-ralph) (maintained by @tdroxler) - [x] [rasi](https://github.com/Fymyte/tree-sitter-rasi) (maintained by @Fymyte) +- [x] [razor](https://github.com/tris203/tree-sitter-razor) (maintained by @tris203) - [x] [rbs](https://github.com/joker1007/tree-sitter-rbs) (maintained by @joker1007) - [x] [re2c](https://github.com/amaanq/tree-sitter-re2c) (maintained by @amaanq) - [x] [readline](https://github.com/ribru17/tree-sitter-readline) (maintained by @ribru17) diff --git a/lockfile.json b/lockfile.json index f95804e77..abad98ee1 100644 --- a/lockfile.json +++ b/lockfile.json @@ -638,6 +638,9 @@ "rasi": { "revision": "6c9bbcfdf5f0f553d9ebc01750a3aa247a37b8aa" }, + "razor": { + "revision": "a47cd8ca148685629739a4ab69f58864800fbdab" + }, "rbs": { "revision": "de893b166476205b09e79cd3689f95831269579a" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index ca2fb11b0..986f2a972 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1861,6 +1861,14 @@ list.rasi = { maintainers = { "@Fymyte" }, } +list.razor = { + install_info = { + url = "https://github.com/tris203/tree-sitter-razor", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@tris203" }, +} + list.rbs = { install_info = { url = "https://github.com/joker1007/tree-sitter-rbs", diff --git a/queries/razor/folds.scm b/queries/razor/folds.scm new file mode 100644 index 000000000..f026cb8ec --- /dev/null +++ b/queries/razor/folds.scm @@ -0,0 +1,14 @@ +[ + (razor_if) + (razor_switch) + (razor_for) + (razor_foreach) + (razor_while) + (razor_do_while) + (razor_try) + (razor_catch) + (razor_finally) + (razor_compound_using) + (razor_section) + (razor_block) +] @fold diff --git a/queries/razor/highlights.scm b/queries/razor/highlights.scm new file mode 100644 index 000000000..2050bde9c --- /dev/null +++ b/queries/razor/highlights.scm @@ -0,0 +1,58 @@ +; inherits: c_sharp + +[ + (razor_comment) + (html_comment) +] @comment @spell + +[ + "at_page" + "at_using" + "at_model" + "at_rendermode" + "at_inject" + "at_implements" + "at_layout" + "at_inherits" + "at_attribute" + "at_typeparam" + "at_namespace" + "at_preservewhitespace" + "at_block" + "at_at_escape" + "at_colon_transition" +] @constant.macro + +[ + "at_lock" + "at_section" +] @keyword + +[ + "at_if" + "at_switch" +] @keyword.conditional + +[ + "at_for" + "at_foreach" + "at_while" + "at_do" +] @keyword.repeat + +[ + "at_try" + "catch" + "finally" +] @keyword.exception + +[ + "at_implicit" + "at_explicit" +] @variable + +"at_await" @keyword.coroutine + +(razor_rendermode) @property + +(razor_attribute_name) @function diff --git a/queries/razor/injections.scm b/queries/razor/injections.scm new file mode 100644 index 000000000..fe28d8611 --- /dev/null +++ b/queries/razor/injections.scm @@ -0,0 +1,11 @@ +; inherits: c_sharp + +([ + (html_comment) + (razor_comment) +] @comment + (#set! injection.language "comment")) + +((element) @injection.content + (#set! injection.language "html") + (#set! injection.combined)) |
