File tree Expand file tree Collapse file tree 8 files changed +123
-0
lines changed
data/fixtures/scopes/java
packages/common/src/scopeSupportFacets Expand file tree Collapse file tree 8 files changed +123
-0
lines changed Original file line number Diff line number Diff line change
1
+ if (true) {}
2
+ else if (false) {}
3
+ else {}
4
+ ---
5
+
6
+ [Range] =
7
+ [Domain] = 0:0-2:7
8
+ >------------
9
+ 0| if (true) {}
10
+ 1| else if (false) {}
11
+ 2| else {}
12
+ -------<
Original file line number Diff line number Diff line change
1
+ if (true) {}
2
+ else if (false) {}
3
+ else {}
4
+ ---
5
+
6
+ [#1 Content] =
7
+ [#1 Domain] = 0:0-0:12
8
+ >------------<
9
+ 0| if (true) {}
10
+
11
+ [#1 Removal] = 0:0-1:5
12
+ >------------
13
+ 0| if (true) {}
14
+ 1| else if (false) {}
15
+ -----<
16
+
17
+ [#1 Insertion delimiter] = "\n"
18
+
19
+
20
+ [#2 Content] =
21
+ [#2 Removal] =
22
+ [#2 Domain] = 1:0-1:18
23
+ >------------------<
24
+ 1| else if (false) {}
25
+
26
+ [#2 Insertion delimiter] = "\n"
27
+
28
+
29
+ [#3 Content] =
30
+ [#3 Removal] =
31
+ [#3 Domain] = 2:0-2:7
32
+ >-------<
33
+ 2| else {}
34
+
35
+ [#3 Insertion delimiter] = "\n"
Original file line number Diff line number Diff line change
1
+ try {}
2
+ catch(Exception e) {}
3
+ finally {}
4
+ ---
5
+
6
+ [Range] =
7
+ [Domain] = 0:0-2:10
8
+ >------
9
+ 0| try {}
10
+ 1| catch(Exception e) {}
11
+ 2| finally {}
12
+ ----------<
Original file line number Diff line number Diff line change
1
+ try {}
2
+ catch(Exception e) {}
3
+ finally {}
4
+ ---
5
+
6
+ [#1 Content] =
7
+ [#1 Removal] =
8
+ [#1 Domain] = 0:0-0:6
9
+ >------<
10
+ 0| try {}
11
+
12
+ [#1 Insertion delimiter] = "\n"
13
+
14
+
15
+ [#2 Content] =
16
+ [#2 Removal] =
17
+ [#2 Domain] = 1:0-1:21
18
+ >---------------------<
19
+ 1| catch(Exception e) {}
20
+
21
+ [#2 Insertion delimiter] = "\n"
22
+
23
+
24
+ [#3 Content] =
25
+ [#3 Removal] =
26
+ [#3 Domain] = 2:0-2:10
27
+ >----------<
28
+ 2| finally {}
29
+
30
+ [#3 Insertion delimiter] = "\n"
Original file line number Diff line number Diff line change @@ -28,4 +28,9 @@ export const javaScopeSupport: LanguageScopeSupportFacetMap = {
28
28
attribute : notApplicable ,
29
29
"key.attribute" : notApplicable ,
30
30
"value.attribute" : notApplicable ,
31
+
32
+ "branch.if" : supported ,
33
+ "branch.if.iteration" : supported ,
34
+ "branch.try" : supported ,
35
+ "branch.try.iteration" : supported ,
31
36
} ;
Original file line number Diff line number Diff line change @@ -310,6 +310,12 @@ export const scopeSupportFacetInfos: Record<
310
310
description : "A try/catch/finally branch" ,
311
311
scopeType : "branch" ,
312
312
} ,
313
+ "branch.try.iteration" : {
314
+ description :
315
+ "Iteration scope for try/catch/finally branch; should be the entire try-catch statement" ,
316
+ scopeType : "branch" ,
317
+ isIteration : true ,
318
+ } ,
313
319
"branch.switchCase" : {
314
320
description : "A case/default branch in a switch/match statement" ,
315
321
scopeType : "branch" ,
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ const scopeSupportFacets = [
79
79
"branch.if" ,
80
80
"branch.if.iteration" ,
81
81
"branch.try" ,
82
+ "branch.try.iteration" ,
82
83
"branch.switchCase" ,
83
84
"branch.switchCase.iteration" ,
84
85
"branch.ternary" ,
Original file line number Diff line number Diff line change 155
155
alternative: (block) @branch.end
156
156
)
157
157
158
+ (
159
+ (if_statement) @branch.iteration
160
+ (#not-parent-type? @branch.iteration " if_statement" )
161
+ )
162
+
163
+ ; ;!! try {}
164
+ ; ;! ^^^^^^
165
+ (try_statement
166
+ " try" @branch.start
167
+ body: (_) @branch.end
168
+ )
169
+
170
+ ; ;!! catch (Exception e) {}
171
+ ; ;! ^^^^^^^^^^^^^^^^^^^^^^
172
+ (catch_clause) @branch
173
+
174
+ ; ;!! finally {}
175
+ ; ;! ^^^^^^^^^^
176
+ (finally_clause) @branch
177
+
178
+ (try_statement) @branch.iteration
179
+
158
180
; ;!! for (int i = 0; i < 5; ++i) {}
159
181
; ;! ^^^^^
160
182
; ;! ------------------------------
You can’t perform that action at this time.
0 commit comments