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 = {
2828 attribute : notApplicable ,
2929 "key.attribute" : notApplicable ,
3030 "value.attribute" : notApplicable ,
31+
32+ "branch.if" : supported ,
33+ "branch.if.iteration" : supported ,
34+ "branch.try" : supported ,
35+ "branch.try.iteration" : supported ,
3136} ;
Original file line number Diff line number Diff line change @@ -310,6 +310,12 @@ export const scopeSupportFacetInfos: Record<
310310 description : "A try/catch/finally branch" ,
311311 scopeType : "branch" ,
312312 } ,
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+ } ,
313319 "branch.switchCase" : {
314320 description : "A case/default branch in a switch/match statement" ,
315321 scopeType : "branch" ,
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ const scopeSupportFacets = [
7979 "branch.if" ,
8080 "branch.if.iteration" ,
8181 "branch.try" ,
82+ "branch.try.iteration" ,
8283 "branch.switchCase" ,
8384 "branch.switchCase.iteration" ,
8485 "branch.ternary" ,
Original file line number Diff line number Diff line change 155155 alternative: (block) @branch.end
156156)
157157
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+
158180;; !! for (int i = 0; i < 5; ++i) {}
159181;; ! ^^^^^
160182;; ! ------------------------------
You can’t perform that action at this time.
0 commit comments