Skip to content

Commit 475e59b

Browse files
committed
feat(c_sharp): support @function for property,indexer,operator and conversion operator
Property, indexer, operator, conversion operator are special functions that we should support `@function` captures for them.
1 parent 1b2d85d commit 475e59b

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

queries/c_sharp/textobjects.scm

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,83 @@
4444
body: (arrow_expression_clause
4545
_+ @function.inner)) @function.outer
4646

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

119+
; constructor without body(metadata)
120+
(constructor_declaration
121+
_+
122+
";") @function.outer
123+
54124
(lambda_expression
55125
body: (block
56126
.

0 commit comments

Comments
 (0)