mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat: add rbs parser support (#5745)
This commit is contained in:
parent
36f81e698e
commit
b41bbcbb9a
7 changed files with 160 additions and 0 deletions
|
|
@ -346,6 +346,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
|||
- [x] [r](https://github.com/r-lib/tree-sitter-r) (maintained by @echasnovski)
|
||||
- [ ] [racket](https://github.com/6cdh/tree-sitter-racket)
|
||||
- [x] [rasi](https://github.com/Fymyte/tree-sitter-rasi) (maintained by @Fymyte)
|
||||
- [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] [regex](https://github.com/tree-sitter/tree-sitter-regex) (maintained by @theHamsta)
|
||||
- [x] [rego](https://github.com/FallenAngel97/tree-sitter-rego) (maintained by @FallenAngel97)
|
||||
|
|
|
|||
|
|
@ -518,6 +518,9 @@
|
|||
"rasi": {
|
||||
"revision": "371dac6bcce0df5566c1cfebde69d90ecbeefd2d"
|
||||
},
|
||||
"rbs": {
|
||||
"revision": "192eda46774fd0281cdd41d372d5b4da86148780"
|
||||
},
|
||||
"re2c": {
|
||||
"revision": "47aa19cf5f7aba2ed30e2b377f7172df76e819a6"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1536,6 +1536,14 @@ list.rasi = {
|
|||
maintainers = { "@Fymyte" },
|
||||
}
|
||||
|
||||
list.rbs = {
|
||||
install_info = {
|
||||
url = "https://github.com/joker1007/tree-sitter-rbs",
|
||||
files = { "src/parser.c" },
|
||||
},
|
||||
maintainers = { "@joker1007" },
|
||||
}
|
||||
|
||||
list.re2c = {
|
||||
install_info = {
|
||||
url = "https://github.com/amaanq/tree-sitter-re2c",
|
||||
|
|
|
|||
5
queries/rbs/folds.scm
Normal file
5
queries/rbs/folds.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[
|
||||
(class_decl)
|
||||
(module_decl)
|
||||
(interface_decl)
|
||||
] @fold
|
||||
117
queries/rbs/highlights.scm
Normal file
117
queries/rbs/highlights.scm
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
; Use directive
|
||||
|
||||
(use_clause
|
||||
[
|
||||
(type_name)
|
||||
(simple_type_name)
|
||||
] @type)
|
||||
|
||||
; Buitin constants and Keywords
|
||||
|
||||
[
|
||||
"true"
|
||||
"false"
|
||||
] @boolean
|
||||
|
||||
"nil" @constant.builtin
|
||||
|
||||
[
|
||||
"use"
|
||||
"as"
|
||||
"class"
|
||||
"module"
|
||||
"interface"
|
||||
"type"
|
||||
"def"
|
||||
"attr_reader"
|
||||
"attr_writer"
|
||||
"attr_accessor"
|
||||
"end"
|
||||
"alias"
|
||||
] @keyword
|
||||
|
||||
"def" @keyword.function
|
||||
|
||||
; Members of declaration
|
||||
|
||||
[
|
||||
"include"
|
||||
"extend"
|
||||
"prepend"
|
||||
] @function.method
|
||||
|
||||
(visibility) @type.qualifier
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
(method_member
|
||||
(method_name
|
||||
[
|
||||
(identifier)
|
||||
(constant)
|
||||
(operator)
|
||||
(setter)
|
||||
] @method))
|
||||
|
||||
[(ivar_name) (cvar_name)] @property
|
||||
|
||||
(alias_member (method_name) @function)
|
||||
|
||||
(class_name (constant) @type)
|
||||
(module_name (constant) @type)
|
||||
(interface_name (interface) @type)
|
||||
(alias_name (identifier) @type)
|
||||
(type_variable) @constant
|
||||
(namespace (constant) @namespace)
|
||||
|
||||
(builtin_type) @type.builtin
|
||||
|
||||
(const_name (constant) @constant)
|
||||
(global_name) @property
|
||||
|
||||
; Standard Arguments
|
||||
(parameter (var_name) @parameter)
|
||||
|
||||
; Keyword Arguments
|
||||
(keyword) @parameter
|
||||
|
||||
; Self
|
||||
(self) @variable.builtin
|
||||
|
||||
; Literal
|
||||
(type (symbol_literal) @symbol)
|
||||
|
||||
(type (string_literal (escape_sequence) @string.escape))
|
||||
(type (string_literal) @string)
|
||||
|
||||
(type (integer_literal) @number)
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"="
|
||||
"->"
|
||||
"<"
|
||||
"**"
|
||||
"*"
|
||||
"&"
|
||||
"|"
|
||||
"^"
|
||||
] @operator
|
||||
|
||||
; Punctuation
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
|
||||
[
|
||||
","
|
||||
"."
|
||||
] @punctuation.delimiter
|
||||
24
queries/rbs/indents.scm
Normal file
24
queries/rbs/indents.scm
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
[
|
||||
(class_decl)
|
||||
(module_decl)
|
||||
(interface_decl)
|
||||
(parameters)
|
||||
(tuple_type)
|
||||
(record_type)
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"end"
|
||||
")"
|
||||
"]"
|
||||
"}"
|
||||
] @indent.end
|
||||
|
||||
[
|
||||
"end"
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @indent.branch
|
||||
|
||||
(comment) @indent.auto
|
||||
2
queries/rbs/injections.scm
Normal file
2
queries/rbs/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue