Skip to content

Commit 21047ff

Browse files
Working on branches
1 parent 9a22fe7 commit 21047ff

File tree

3 files changed

+90
-2
lines changed

3 files changed

+90
-2
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Obsolete("Deprecated")]
2+
void foo() {}
3+
---

packages/common/src/scopeSupportFacets/csharp.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
22
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
33

4-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
5-
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;
4+
const { supported, notApplicable } = ScopeSupportFacetLevel;
65

76
export const csharpScopeSupport: LanguageScopeSupportFacetMap = {
87
ifStatement: supported,
@@ -11,6 +10,7 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = {
1110
map: supported,
1211
list: supported,
1312
disqualifyDelimiter: supported,
13+
attribute: supported,
1414

1515
class: supported,
1616
"class.iteration.document": supported,
@@ -35,6 +35,15 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = {
3535
"functionName.method": supported,
3636
"functionName.method.iteration.class": supported,
3737

38+
"branch.if": supported,
39+
"branch.if.iteration": supported,
40+
"branch.try": supported,
41+
"branch.try.iteration": supported,
42+
"branch.switchCase": supported,
43+
"branch.switchCase.iteration": supported,
44+
"branch.ternary": supported,
45+
"branch.loop": supported,
46+
3847
"condition.for": supported,
3948
"condition.while": supported,
4049
"condition.doWhile": supported,
@@ -83,5 +92,7 @@ export const csharpScopeSupport: LanguageScopeSupportFacetMap = {
8392
"argument.formal.method": supported,
8493
"argument.formal.method.iteration": supported,
8594

95+
// Not applicable
96+
8697
regularExpression: notApplicable,
8798
};

queries/csharp.scm

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,77 @@
5050

5151
(if_statement) @ifStatement
5252

53+
;;!! if () {}
54+
;;! ^^^^^^^^
55+
(
56+
(if_statement
57+
condition: (_) @condition
58+
consequence: (_) @branch.end.endOf @branch.removal.end.endOf
59+
alternative: (_)? @branch.removal.end.startOf
60+
) @branch.start.startOf @branch.removal.start.startOf @condition.domain
61+
(#not-parent-type? @condition.domain "if_statement")
62+
)
63+
64+
;;!! else if () {}
65+
;;! ^^^^^^^^^^^^^
66+
(if_statement
67+
"else" @branch.start.startOf @condition.domain.start.startOf
68+
(if_statement
69+
condition: (_) @condition
70+
consequence: (_) @branch.end.endOf @condition.domain.end.endOf
71+
)
72+
)
73+
74+
;;!! else {}
75+
;;! ^^^^^^^
76+
(if_statement
77+
"else" @branch.start
78+
alternative: (block) @branch.end
79+
)
80+
81+
;;!! if () {} else if () {} else {}
82+
;;! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
83+
(
84+
(if_statement) @branch.iteration
85+
(#not-parent-type? @branch.iteration "if_statement")
86+
)
87+
88+
;;!! try () {}
89+
;;! ^^^^^^^^^
90+
(try_statement
91+
body: (_) @branch.end.endOf
92+
) @branch.start.startOf
93+
94+
;;!! catch () {}
95+
;;! ^^^^^^^^^^^
96+
(catch_clause) @branch
97+
98+
;;!! finally {}
99+
;;! ^^^^^^^^^^
100+
(finally_clause) @branch
101+
102+
;;!! try () {} catch () {} finally {}
103+
;;! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104+
(try_statement) @branch.iteration
105+
106+
[
107+
(for_statement)
108+
(for_each_statement)
109+
(while_statement)
110+
(do_statement)
111+
] @branch
112+
113+
;;!! true ? 0 : 1;
114+
;;! ^^^^
115+
;;! ^ ^
116+
(conditional_expression
117+
condition: (_) @condition
118+
consequence: (_) @branch
119+
) @condition.domain
120+
(conditional_expression
121+
alternative: (_) @branch
122+
) @condition.domain
123+
53124
(class_declaration
54125
name: (identifier) @className
55126
) @class @_.domain
@@ -75,10 +146,13 @@
75146
(string_literal) @string @textFragment
76147
(#child-range! @textFragment 0 -1 true true)
77148
)
149+
78150
(comment) @comment @textFragment
79151

80152
(lambda_expression) @anonymousFunction
81153

154+
(attribute) @attribute
155+
82156
[
83157
(delegate_declaration
84158
name: (_) @functionName

0 commit comments

Comments
 (0)