Skip to content

Commit 2fb06a1

Browse files
authored
typescript: Add support for default branches (#2362)
- Fixes #2360 ## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [-] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [-] I have not broken the cheatsheet
1 parent 4c6fc54 commit 2fb06a1

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed
Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,36 @@
11
switch (value) {
22
case 0: { }
3+
default: { }
34
}
45
---
56

6-
[Content] =
7-
[Domain] = 1:2-1:13
7+
[#1 Content] =
8+
[#1 Domain] = 1:2-1:13
89
>-----------<
910
1| case 0: { }
1011

11-
[Removal] = 1:0-1:13
12+
[#1 Removal] = 1:0-1:13
1213
>-------------<
1314
1| case 0: { }
1415

15-
[Leading delimiter] = 1:0-1:2
16+
[#1 Leading delimiter] = 1:0-1:2
1617
>--<
1718
1| case 0: { }
1819

19-
[Insertion delimiter] = "\n"
20+
[#1 Insertion delimiter] = "\n"
21+
22+
23+
[#2 Content] =
24+
[#2 Domain] = 2:2-2:14
25+
>------------<
26+
2| default: { }
27+
28+
[#2 Removal] = 2:0-2:14
29+
>--------------<
30+
2| default: { }
31+
32+
[#2 Leading delimiter] = 2:0-2:2
33+
>--<
34+
2| default: { }
35+
36+
[#2 Insertion delimiter] = "\n"

queries/javascript.core.scm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,8 @@
567567
value: (_) @condition
568568
) @branch @condition.domain
569569

570+
(switch_default) @branch
571+
570572
;;!! switch () {}
571573
;;! ^^^^^^^^^^^^
572574
(switch_statement) @branch.iteration @condition.iteration

0 commit comments

Comments
 (0)