Skip to content

Commit 9c65cc8

Browse files
committed
style: re-format all *.scm files with ts_query_ls
1 parent f0843a8 commit 9c65cc8

File tree

9 files changed

+404
-335
lines changed

9 files changed

+404
-335
lines changed

languages/rbs/indents.scm

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,16 @@
77
(record_type)
88
] @indent.begin
99

10-
(_ "[" "]" @end) @indent
11-
(_ "{" "}" @end) @indent
12-
(_ "(" ")" @end) @indent
10+
(_
11+
"["
12+
"]" @end) @indent
13+
14+
(_
15+
"{"
16+
"}" @end) @indent
17+
18+
(_
19+
"("
20+
")" @end) @indent
1321

1422
(comment) @indent.ignore

languages/ruby/brackets.scm

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,48 @@
1-
("(" @open ")" @close)
2-
("[" @open "]" @close)
3-
("{" @open "}" @close)
4-
("\"" @open "\"" @close)
5-
("do" @open "end" @close)
6-
7-
(block_parameters "|" @open "|" @close)
8-
(interpolation "#{" @open "}" @close)
9-
10-
(if "if" @open "end" @close)
11-
(unless "unless" @open "end" @close)
12-
(begin "begin" @open "end" @close)
13-
(module "module" @open "end" @close)
14-
(_ . "def" @open "end" @close)
15-
(_ . "class" @open "end" @close)
1+
("(" @open
2+
")" @close)
3+
4+
("[" @open
5+
"]" @close)
6+
7+
("{" @open
8+
"}" @close)
9+
10+
("\"" @open
11+
"\"" @close)
12+
13+
("do" @open
14+
"end" @close)
15+
16+
(block_parameters
17+
"|" @open
18+
"|" @close)
19+
20+
(interpolation
21+
"#{" @open
22+
"}" @close)
23+
24+
(if
25+
"if" @open
26+
"end" @close)
27+
28+
(unless
29+
"unless" @open
30+
"end" @close)
31+
32+
(begin
33+
"begin" @open
34+
"end" @close)
35+
36+
(module
37+
"module" @open
38+
"end" @close)
39+
40+
(_
41+
.
42+
"def" @open
43+
"end" @close)
44+
45+
(_
46+
.
47+
"class" @open
48+
"end" @close)

languages/ruby/debugger.scm

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,35 @@
1-
(assignment left: (identifier) @debug-variable)
2-
(assignment left: (call receiver: (identifier) @debug-variable))
3-
(assignment left: (call method: (identifier) @debug-variable))
4-
(call (argument_list (call receiver: (identifier) @debug-variable)))
5-
(call (argument_list (call method: (identifier) @debug-variable)))
1+
(assignment
2+
left: (identifier) @debug-variable)
63

7-
(call (argument_list (identifier) @debug-variable))
4+
(assignment
5+
left: (call
6+
receiver: (identifier) @debug-variable))
87

9-
(method (method_parameters) @debug-variable)
10-
(body_statement (assignment (instance_variable) @debug-variable))
8+
(assignment
9+
left: (call
10+
method: (identifier) @debug-variable))
11+
12+
(call
13+
(argument_list
14+
(call
15+
receiver: (identifier) @debug-variable)))
16+
17+
(call
18+
(argument_list
19+
(call
20+
method: (identifier) @debug-variable)))
21+
22+
(call
23+
(argument_list
24+
(identifier) @debug-variable))
25+
26+
(method
27+
(method_parameters) @debug-variable)
28+
29+
(body_statement
30+
(assignment
31+
(instance_variable) @debug-variable))
1132

1233
(program) @debug-scope
34+
1335
(body_statement) @debug-scope

languages/ruby/embedding.scm

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
(
2-
(comment)* @context
3-
.
4-
[
5-
(module
6-
"module" @name
7-
name: (_) @name)
8-
(method
9-
"def" @name
10-
name: (_) @name
11-
body: (body_statement) @collapse)
12-
(class
13-
"class" @name
14-
name: (_) @name)
15-
(singleton_method
16-
"def" @name
17-
object: (_) @name
18-
"." @name
19-
name: (_) @name
20-
body: (body_statement) @collapse)
21-
] @item
22-
)
1+
((comment)* @context
2+
.
3+
[
4+
(module
5+
"module" @name
6+
name: (_) @name)
7+
(method
8+
"def" @name
9+
name: (_) @name
10+
body: (body_statement) @collapse)
11+
(class
12+
"class" @name
13+
name: (_) @name)
14+
(singleton_method
15+
"def" @name
16+
object: (_) @name
17+
"." @name
18+
name: (_) @name
19+
body: (body_statement) @collapse)
20+
] @item)

languages/ruby/highlights.scm

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
] @variable
66

77
; Keywords
8-
98
[
109
"alias"
1110
"and"
@@ -40,41 +39,63 @@
4039
(#match? @keyword "^(private|protected|public)$"))
4140

4241
; Function calls
43-
4442
(call
45-
method: [(identifier) (constant)] @function.method)
43+
method: [
44+
(identifier)
45+
(constant)
46+
] @function.method)
4647

4748
((identifier) @keyword.import
48-
(#any-of? @keyword.import "require" "require_relative" "load"))
49+
(#any-of? @keyword.import "require" "require_relative" "load"))
4950

5051
"defined?" @function.method.builtin
5152

5253
; Function definitions
53-
54-
(alias (identifier) @function.method)
55-
(setter (identifier) @function.method)
56-
(method name: [(identifier) (constant)] @function.method)
57-
(singleton_method name: [(identifier) (constant)] @function.method)
58-
(method_parameters [
59-
(identifier) @variable.parameter
60-
(optional_parameter name: (identifier) @variable.parameter)
61-
(keyword_parameter [name: (identifier) (":")] @variable.parameter)
54+
(alias
55+
(identifier) @function.method)
56+
57+
(setter
58+
(identifier) @function.method)
59+
60+
(method
61+
name: [
62+
(identifier)
63+
(constant)
64+
] @function.method)
65+
66+
(singleton_method
67+
name: [
68+
(identifier)
69+
(constant)
70+
] @function.method)
71+
72+
(method_parameters
73+
[
74+
(identifier) @variable.parameter
75+
(optional_parameter
76+
name: (identifier) @variable.parameter)
77+
(keyword_parameter
78+
[
79+
name: (identifier)
80+
":"
81+
] @variable.parameter)
6282
])
6383

64-
(block_parameters (identifier) @variable.parameter)
84+
(block_parameters
85+
(identifier) @variable.parameter)
6586

6687
; Identifiers
67-
6888
((identifier) @constant.builtin
6989
(#match? @constant.builtin "^__(FILE|LINE|ENCODING)__$"))
7090

7191
(file) @constant.builtin
92+
7293
(line) @constant.builtin
94+
7395
(encoding) @constant.builtin
7496

7597
(hash_splat_nil
76-
"**" @operator
77-
) @constant.builtin
98+
"**" @operator) @constant.builtin
7899

79100
(constant) @type
80101

@@ -94,6 +115,7 @@
94115
(constant) @type.super)))
95116

96117
(self) @variable.special
118+
97119
(super) @variable.special
98120

99121
[
@@ -110,7 +132,6 @@
110132
(#any-of? @keyword.exception "raise" "fail" "catch" "throw"))
111133

112134
; Literals
113-
114135
[
115136
(string)
116137
(bare_string)
@@ -127,6 +148,7 @@
127148
] @string.special.symbol
128149

129150
(regex) @string.regex
151+
130152
(escape_sequence) @string.escape
131153

132154
[
@@ -139,17 +161,14 @@
139161
(false)
140162
] @boolean
141163

142-
[
143-
(nil)
144-
] @constant.builtin
164+
(nil) @constant.builtin
145165

146166
; Regular comments (exclude RBS inline comments)
147167
((comment) @comment
148168
(#not-match? @comment "^\\s*#[:|]")
149169
(#not-match? @comment "^\\s*#\\s*(@rbs|\\|)"))
150170

151171
; Operators
152-
153172
[
154173
"!"
155174
"~"

languages/ruby/indents.scm

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1-
(method "end" @end) @indent
2-
(class "end" @end) @indent
3-
(module "end" @end) @indent
4-
(begin "end" @end) @indent
5-
(singleton_method "end" @end) @indent
6-
(do_block "end" @end) @indent
1+
(method
2+
"end" @end) @indent
3+
4+
(class
5+
"end" @end) @indent
6+
7+
(module
8+
"end" @end) @indent
9+
10+
(begin
11+
"end" @end) @indent
12+
13+
(singleton_method
14+
"end" @end) @indent
15+
16+
(do_block
17+
"end" @end) @indent
718

819
[
920
(then)
@@ -15,6 +26,14 @@
1526
(rescue)
1627
] @outdent
1728

18-
(_ "[" "]" @end) @indent
19-
(_ "{" "}" @end) @indent
20-
(_ "(" ")" @end) @indent
29+
(_
30+
"["
31+
"]" @end) @indent
32+
33+
(_
34+
"{"
35+
"}" @end) @indent
36+
37+
(_
38+
"("
39+
")" @end) @indent

0 commit comments

Comments
 (0)