Skip to content

Commit ea79012

Browse files
authored
feat(c_sharp): support more @function capture (#800)
Property, indexer, operator, conversion operator are special functions that we should support `@function` captures for them.
1 parent d314205 commit ea79012

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

queries/c_sharp/textobjects.scm

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,103 @@
4545
"=>"
4646
_+ @function.inner)) @function.outer
4747

48+
; method without body(abstract method/decompiled metadata)
49+
(method_declaration
50+
_+
51+
";") @function.outer
52+
53+
(property_declaration
54+
accessors: (accessor_list
55+
(accessor_declaration
56+
body: (block
57+
.
58+
"{"
59+
_* @function.inner
60+
"}")) @function.outer))
61+
62+
(property_declaration
63+
accessors: (accessor_list
64+
(accessor_declaration
65+
body: (arrow_expression_clause
66+
"=>"
67+
_* @function.inner)) @function.outer))
68+
69+
(indexer_declaration
70+
accessors: (accessor_list
71+
(accessor_declaration
72+
body: (arrow_expression_clause
73+
"=>"
74+
_+ @function.inner)) @function.outer))
75+
76+
(indexer_declaration
77+
accessors: (accessor_list
78+
(accessor_declaration
79+
body: (block
80+
.
81+
"{"
82+
_* @function.inner
83+
"}")) @function.outer))
84+
85+
(conversion_operator_declaration
86+
body: (block
87+
.
88+
"{"
89+
_* @function.inner
90+
"}")) @function.outer
91+
92+
(conversion_operator_declaration
93+
body: (arrow_expression_clause
94+
"=>"
95+
_+ @function.inner)) @function.outer
96+
97+
(operator_declaration
98+
body: (block
99+
.
100+
"{"
101+
_* @function.inner
102+
"}")) @function.outer
103+
104+
; operator without body(abstract/decompiled metadata)
105+
(operator_declaration
106+
_+
107+
";") @function.outer
108+
109+
(operator_declaration
110+
body: (arrow_expression_clause
111+
"=>"
112+
_+ @function.inner)) @function.outer
113+
48114
(constructor_declaration
49115
body: (block
50116
.
51117
"{"
52118
_+ @function.inner
53119
"}")) @function.outer
54120

121+
; constructor without body(metadata)
122+
(constructor_declaration
123+
_+
124+
";") @function.outer
125+
126+
(local_function_statement
127+
body: (block
128+
.
129+
"{"
130+
_* @function.inner
131+
"}")) @function.outer
132+
133+
(local_function_statement
134+
body: (arrow_expression_clause
135+
"=>"
136+
_+ @function.inner)) @function.outer
137+
138+
(anonymous_method_expression
139+
(block
140+
.
141+
"{"
142+
_* @function.inner
143+
"}")) @function.outer
144+
55145
(lambda_expression
56146
body: (block
57147
.

0 commit comments

Comments
 (0)