on master help sign in
Ruby TextObjects and more file extensions (#2143)
be656c1Danillo Melo
book/src/generated/lang-support.md+1−1
@@ -61,7 +61,7 @@
61| rescript | ✓ | ✓ | | `rescript-language-server` |
61| rescript | ✓ | ✓ | | `rescript-language-server` |
62| rmarkdown | ✓ | | ✓ | `R` |
62| rmarkdown | ✓ | | ✓ | `R` |
63| ron | ✓ | | ✓ | |
63| ron | ✓ | | ✓ | |
64−| ruby | ✓ | | ✓ | `solargraph` |
64+| ruby | ✓ | ✓ | ✓ | `solargraph` |
65| rust | ✓ | ✓ | ✓ | `rust-analyzer` |
65| rust | ✓ | ✓ | ✓ | `rust-analyzer` |
66| scala | ✓ | | ✓ | `metals` |
66| scala | ✓ | | ✓ | `metals` |
67| solidity | ✓ | | | `solc` |
67| solidity | ✓ | | | `solc` |
languages.toml+1−1
@@ -399,7 +399,7 @@ source = { git = "https://github.com/cstrahan/tree-sitter-nix", rev = "50f38ceab
399name = "ruby"
399name = "ruby"
400scope = "source.ruby"
400scope = "source.ruby"
401injection-regex = "ruby"
401injection-regex = "ruby"
402−file-types = ["rb"]
402+file-types = ["rb", "rake", "rakefile", "irb", "gemfile", "gemspec"]
403shebangs = ["ruby"]
403shebangs = ["ruby"]
404roots = []
404roots = []
405comment-token = "#"
405comment-token = "#"
runtime/queries/ruby/textobjects.scmnew file+54
@@ -0,0 +1,54 @@
1+; Class
2+(class) @class.around
3+
4+(class [(constant) (scope_resolution)] !superclass
5+ (_)+ @class.inside)
6+
7+(class [(constant) (scope_resolution)] (superclass)
8+ (_)+ @class.inside)
9+
10+(singleton_class
11+ value: (_)
12+ (_)+ @class.inside) @class.around
13+
14+(call
15+ receiver: (constant) @class_const
16+ method: (identifier) @class_method
17+ (#match? @class_const "Class")
18+ (#match? @class_method "new")
19+ (do_block (_)+ @class.inside)) @class.around
20+
21+; Functions
22+(method) @function.around
23+
24+(method (identifier) (method_parameters)
25+ (_)+ @function.inside)
26+
27+(do_block !parameters
28+ (_)+ @function.inside)
29+
30+(do_block (block_parameters)
31+ (_)+ @function.inside)
32+
33+(block (block_parameters)
34+ (_)+ @function.inside)
35+
36+(block !parameters
37+ (_)+ @function.inside)
38+
39+(method (identifier) !parameters
40+ (_)+ @function.inside)
41+
42+; Parameters
43+(method_parameters
44+ (_) @parameter.inside)
45+
46+(block_parameters
47+ (_) @parameter.inside)
48+
49+(lambda_parameters
50+ (_) @parameter.inside)
51+
52+; Comments
53+(comment) @comment.inside
54+(comment)+ @comment.around