Skip to content

Commit 95ef93a

Browse files
authored
Fix removal range with type (#2460)
## 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 11037ef commit 95ef93a

File tree

2 files changed

+44
-5
lines changed

2 files changed

+44
-5
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
function myFunk(value: number = 2) { }
2+
---
3+
4+
[Content] = 0:32-0:33
5+
>-<
6+
0| function myFunk(value: number = 2) { }
7+
8+
[Removal] = 0:29-0:33
9+
>----<
10+
0| function myFunk(value: number = 2) { }
11+
12+
[Leading delimiter] = 0:29-0:32
13+
>---<
14+
0| function myFunk(value: number = 2) { }
15+
16+
[Domain] = 0:16-0:33
17+
>-----------------<
18+
0| function myFunk(value: number = 2) { }
19+
20+
[Insertion delimiter] = " "

queries/typescript.core.scm

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,38 @@
44

55
;; import javascript.core.scm
66

7+
;;!! function aaa(bbb = "ddd") {}
8+
;;! ^^^--------
9+
(required_parameter
10+
(identifier) @_.leading.endOf
11+
value: (_) @value
12+
!type
13+
) @_.domain
14+
15+
;;!! function aaa(bbb: Ccc = "ddd") {}
16+
;;! ^^^-------------
17+
(required_parameter
18+
type: (_) @_.leading.endOf
19+
value: (_) @value
20+
) @_.domain
21+
722
;;!! function aaa(bbb?: Ccc = "ddd") {}
823
;;! ^^^--------------
924
(optional_parameter
10-
(identifier) @name
11-
type: (_)? @value.leading.endOf
12-
value: (_)? @value
25+
type: (_) @_.leading.endOf
26+
value: (_) @value
1327
) @_.domain
1428

1529
;;!! function aaa(bbb: Ccc = "ddd") {}
1630
;;! ^^^-------------
1731
(required_parameter
18-
(identifier) @name @value.leading.endOf
19-
value: (_)? @value
32+
(identifier) @name
33+
) @_.domain
34+
35+
;;!! function aaa(bbb?: Ccc) {}
36+
;;! ^^^------
37+
(optional_parameter
38+
(identifier) @name
2039
) @_.domain
2140

2241
;; Define these here because these node types don't exist in javascript.

0 commit comments

Comments
 (0)