Skip to content

Commit f27ce82

Browse files
authored
typescript fix assignment expression name scope (#734)
1 parent 87df330 commit f27ce82

File tree

5 files changed

+93
-0
lines changed

5 files changed

+93
-0
lines changed

src/languages/typescript.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ const nodeMatchers: Partial<Record<ScopeType, NodeMatcherAlternative>> = {
183183
"optional_parameter.identifier!",
184184
"required_parameter.identifier!",
185185
"augmented_assignment_expression[left]",
186+
"assignment_expression[left]",
186187
],
187188
comment: "comment",
188189
regularExpression: "regex",
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: 1
4+
spokenForm: change name
5+
action: clearAndSetSelection
6+
targets:
7+
- type: primitive
8+
modifier: {type: containingScope, scopeType: name, includeSiblings: false}
9+
initialState:
10+
documentContents: this.leadingDelimiterRange_ = parameters.leadingDelimiterRange;
11+
selections:
12+
- anchor: {line: 0, character: 37}
13+
active: {line: 0, character: 37}
14+
marks: {}
15+
finalState:
16+
documentContents: " = parameters.leadingDelimiterRange;"
17+
selections:
18+
- anchor: {line: 0, character: 0}
19+
active: {line: 0, character: 0}
20+
thatMark:
21+
- anchor: {line: 0, character: 0}
22+
active: {line: 0, character: 0}
23+
fullTargets: [{type: primitive, mark: {type: cursor}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: name, includeSiblings: false}, isImplicit: false}]
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: 1
4+
spokenForm: change name
5+
action: clearAndSetSelection
6+
targets:
7+
- type: primitive
8+
modifier: {type: containingScope, scopeType: name, includeSiblings: false}
9+
initialState:
10+
documentContents: leadingDelimiterRange_[0] = parameters.leadingDelimiterRange;
11+
selections:
12+
- anchor: {line: 0, character: 36}
13+
active: {line: 0, character: 36}
14+
marks: {}
15+
finalState:
16+
documentContents: " = parameters.leadingDelimiterRange;"
17+
selections:
18+
- anchor: {line: 0, character: 0}
19+
active: {line: 0, character: 0}
20+
thatMark:
21+
- anchor: {line: 0, character: 0}
22+
active: {line: 0, character: 0}
23+
fullTargets: [{type: primitive, mark: {type: cursor}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: name, includeSiblings: false}, isImplicit: false}]
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: 1
4+
spokenForm: change name
5+
action: clearAndSetSelection
6+
targets:
7+
- type: primitive
8+
modifier: {type: containingScope, scopeType: name, includeSiblings: false}
9+
initialState:
10+
documentContents: let name = parameters.leadingDelimiterRange;
11+
selections:
12+
- anchor: {line: 0, character: 26}
13+
active: {line: 0, character: 26}
14+
marks: {}
15+
finalState:
16+
documentContents: let = parameters.leadingDelimiterRange;
17+
selections:
18+
- anchor: {line: 0, character: 4}
19+
active: {line: 0, character: 4}
20+
thatMark:
21+
- anchor: {line: 0, character: 4}
22+
active: {line: 0, character: 4}
23+
fullTargets: [{type: primitive, mark: {type: cursor}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: name, includeSiblings: false}, isImplicit: false}]
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: 1
4+
spokenForm: change name
5+
action: clearAndSetSelection
6+
targets:
7+
- type: primitive
8+
modifier: {type: containingScope, scopeType: name, includeSiblings: false}
9+
initialState:
10+
documentContents: foo().bar = parameters.leadingDelimiterRange;
11+
selections:
12+
- anchor: {line: 0, character: 25}
13+
active: {line: 0, character: 26}
14+
marks: {}
15+
finalState:
16+
documentContents: " = parameters.leadingDelimiterRange;"
17+
selections:
18+
- anchor: {line: 0, character: 0}
19+
active: {line: 0, character: 0}
20+
thatMark:
21+
- anchor: {line: 0, character: 0}
22+
active: {line: 0, character: 0}
23+
fullTargets: [{type: primitive, mark: {type: cursor}, selectionType: token, position: contents, insideOutsideType: inside, modifier: {type: containingScope, scopeType: name, includeSiblings: false}, isImplicit: false}]

0 commit comments

Comments
 (0)