Skip to content

Commit 54c2eed

Browse files
Support function declaration
1 parent b9b4464 commit 54c2eed

File tree

7 files changed

+168
-0
lines changed

7 files changed

+168
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
languageId: typescript
2+
command:
3+
version: 6
4+
spokenForm: change type
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: type}
12+
usePrePhraseSnapshot: true
13+
initialState:
14+
documentContents: foo<Record<string, string>>()
15+
selections:
16+
- anchor: {line: 0, character: 4}
17+
active: {line: 0, character: 4}
18+
marks: {}
19+
finalState:
20+
documentContents: foo<>()
21+
selections:
22+
- anchor: {line: 0, character: 4}
23+
active: {line: 0, character: 4}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
languageId: typescript
2+
command:
3+
version: 6
4+
spokenForm: change type
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: type}
12+
usePrePhraseSnapshot: true
13+
initialState:
14+
documentContents: foo<string, string>()
15+
selections:
16+
- anchor: {line: 0, character: 4}
17+
active: {line: 0, character: 4}
18+
marks: {}
19+
finalState:
20+
documentContents: foo<, string>()
21+
selections:
22+
- anchor: {line: 0, character: 4}
23+
active: {line: 0, character: 4}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
languageId: typescript
2+
command:
3+
version: 6
4+
spokenForm: change type
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: type}
12+
usePrePhraseSnapshot: true
13+
initialState:
14+
documentContents: foo<string, string>()
15+
selections:
16+
- anchor: {line: 0, character: 12}
17+
active: {line: 0, character: 12}
18+
marks: {}
19+
finalState:
20+
documentContents: foo<string, >()
21+
selections:
22+
- anchor: {line: 0, character: 12}
23+
active: {line: 0, character: 12}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
languageId: typescript
2+
command:
3+
version: 6
4+
spokenForm: change type
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: type}
12+
usePrePhraseSnapshot: true
13+
initialState:
14+
documentContents: Foo<string>()
15+
selections:
16+
- anchor: {line: 0, character: 4}
17+
active: {line: 0, character: 4}
18+
marks: {}
19+
finalState:
20+
documentContents: Foo<>()
21+
selections:
22+
- anchor: {line: 0, character: 4}
23+
active: {line: 0, character: 4}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
languageId: typescript
2+
command:
3+
version: 6
4+
spokenForm: change type
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: type}
12+
usePrePhraseSnapshot: true
13+
initialState:
14+
documentContents: |+
15+
function foo<A>() {
16+
17+
}
18+
19+
selections:
20+
- anchor: {line: 0, character: 13}
21+
active: {line: 0, character: 13}
22+
marks: {}
23+
finalState:
24+
documentContents: |+
25+
function foo<>() {
26+
27+
}
28+
29+
selections:
30+
- anchor: {line: 0, character: 13}
31+
active: {line: 0, character: 13}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
languageId: typescript
2+
command:
3+
version: 6
4+
spokenForm: change type
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: type}
12+
usePrePhraseSnapshot: true
13+
initialState:
14+
documentContents: |
15+
const bar = <A>() => {
16+
17+
}
18+
selections:
19+
- anchor: {line: 0, character: 13}
20+
active: {line: 0, character: 13}
21+
marks: {}
22+
finalState:
23+
documentContents: |
24+
const bar = <>() => {
25+
26+
}
27+
selections:
28+
- anchor: {line: 0, character: 13}
29+
active: {line: 0, character: 13}

queries/typescript.core.scm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,22 @@
183183
)
184184
)
185185

186+
;;!! function foo<A>() {}
187+
;;! ^
188+
(function_declaration
189+
type_parameters: (type_parameters
190+
(_) @type
191+
)
192+
)
193+
194+
;;!! const foo = <A>() => {}
195+
;;! ^
196+
(arrow_function
197+
type_parameters: (type_parameters
198+
(_) @type
199+
)
200+
)
201+
186202
;;!! interface Aaa {}
187203
;;!! type Aaa = Bbb;
188204
(

0 commit comments

Comments
 (0)