on master help sign in
Ruby TextObjects and more file extensions (#2143)
commitbe656c14e32243fc32ed68f9a3240301f2902df7 authorDanillo Melo <danillos@gmail.com> dateSun 17 Apr 2022, 21:25 (5 years ago) parentad36a02
3 files changed+56−2
book/src/generated/lang-support.md+1−1 languages.toml+1−1 runtime/queries/ruby/textobjects.scm+54
book/src/generated/lang-support.md+1−1
@@ -61,7 +61,7 @@
6161| rescript | ✓ | ✓ | | `rescript-language-server` |
6262| rmarkdown | ✓ | | ✓ | `R` |
6363| ron | ✓ | | ✓ | |
64−| ruby | ✓ | | ✓ | `solargraph` |
64+| ruby | ✓ | ✓ | ✓ | `solargraph` |
6565| rust | ✓ | ✓ | ✓ | `rust-analyzer` |
6666| scala | ✓ | | ✓ | `metals` |
6767| solidity | ✓ | | | `solc` |
languages.toml+1−1
@@ -399,7 +399,7 @@ source = { git = "https://github.com/cstrahan/tree-sitter-nix", rev = "50f38ceab
399399name = "ruby"
400400scope = "source.ruby"
401401injection-regex = "ruby"
402−file-types = ["rb"]
402+file-types = ["rb", "rake", "rakefile", "irb", "gemfile", "gemspec"]
403403shebangs = ["ruby"]
404404roots = []
405405comment-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