Skip to content

Commit 2a0ccd6

Browse files
Utilize interior in relative scope modifier (#3122)
By utilizing interior scope in relative scope modifier we can skip the interior of scopes. See new test. Fixes #2627 --------- Co-authored-by: Pokey Rule <755842+pokey@users.noreply.github.com>
1 parent 3e96b96 commit 2a0ccd6

18 files changed

Lines changed: 596 additions & 64 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
languageId: plaintext
2+
command:
3+
version: 7
4+
spokenForm: change next pair
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: relativeScope
11+
scopeType: {type: surroundingPair, delimiter: any}
12+
offset: 1
13+
length: 1
14+
direction: forward
15+
usePrePhraseSnapshot: false
16+
initialState:
17+
documentContents: |-
18+
(
19+
()
20+
)
21+
()
22+
selections:
23+
- anchor: {line: 0, character: 0}
24+
active: {line: 0, character: 0}
25+
marks: {}
26+
finalState:
27+
documentContents: |
28+
(
29+
()
30+
)
31+
selections:
32+
- anchor: {line: 3, character: 0}
33+
active: {line: 3, character: 0}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
languageId: plaintext
2+
command:
3+
version: 7
4+
spokenForm: change next pair
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: relativeScope
11+
scopeType: {type: surroundingPair, delimiter: any}
12+
offset: 1
13+
length: 1
14+
direction: forward
15+
usePrePhraseSnapshot: false
16+
initialState:
17+
documentContents: |-
18+
(
19+
20+
()
21+
)
22+
selections:
23+
- anchor: {line: 1, character: 4}
24+
active: {line: 1, character: 4}
25+
marks: {}
26+
finalState:
27+
documentContents: |-
28+
(
29+
30+
31+
)
32+
selections:
33+
- anchor: {line: 2, character: 4}
34+
active: {line: 2, character: 4}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
languageId: typescript
2+
command:
3+
version: 7
4+
spokenForm: change next state
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: relativeScope
11+
scopeType: {type: statement}
12+
offset: 1
13+
length: 1
14+
direction: forward
15+
usePrePhraseSnapshot: false
16+
initialState:
17+
documentContents: |-
18+
if (true) {
19+
const a = 1;
20+
}
21+
const b = 2;
22+
selections:
23+
- anchor: {line: 0, character: 0}
24+
active: {line: 0, character: 0}
25+
marks: {}
26+
finalState:
27+
documentContents: |
28+
if (true) {
29+
const a = 1;
30+
}
31+
selections:
32+
- anchor: {line: 3, character: 0}
33+
active: {line: 3, character: 0}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
languageId: typescript
2+
command:
3+
version: 7
4+
spokenForm: change next state
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: relativeScope
11+
scopeType: {type: statement}
12+
offset: 1
13+
length: 1
14+
direction: forward
15+
usePrePhraseSnapshot: false
16+
initialState:
17+
documentContents: |-
18+
if (true) {
19+
20+
const a = 1;
21+
}
22+
selections:
23+
- anchor: {line: 1, character: 3}
24+
active: {line: 1, character: 3}
25+
marks: {}
26+
finalState:
27+
documentContents: |-
28+
if (true) {
29+
30+
31+
}
32+
selections:
33+
- anchor: {line: 2, character: 3}
34+
active: {line: 2, character: 3}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
languageId: typescript
2+
command:
3+
version: 7
4+
spokenForm: change next state
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: relativeScope
11+
scopeType: {type: statement}
12+
offset: 1
13+
length: 1
14+
direction: forward
15+
usePrePhraseSnapshot: false
16+
initialState:
17+
documentContents: |-
18+
if (true) {
19+
20+
}
21+
else if (false) {
22+
const a = 1;
23+
}
24+
const b = 2;
25+
selections:
26+
- anchor: {line: 1, character: 3}
27+
active: {line: 1, character: 3}
28+
marks: {}
29+
finalState:
30+
documentContents: |
31+
if (true) {
32+
33+
}
34+
else if (false) {
35+
const a = 1;
36+
}
37+
selections:
38+
- anchor: {line: 6, character: 0}
39+
active: {line: 6, character: 0}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
languageId: plaintext
2+
command:
3+
version: 7
4+
spokenForm: change previous pair
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: relativeScope
11+
scopeType: {type: surroundingPair, delimiter: any}
12+
offset: 1
13+
length: 1
14+
direction: backward
15+
usePrePhraseSnapshot: false
16+
initialState:
17+
documentContents: |
18+
()
19+
(
20+
()
21+
)
22+
selections:
23+
- anchor: {line: 3, character: 1}
24+
active: {line: 3, character: 1}
25+
marks: {}
26+
finalState:
27+
documentContents: |
28+
29+
(
30+
()
31+
)
32+
selections:
33+
- anchor: {line: 0, character: 0}
34+
active: {line: 0, character: 0}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
languageId: plaintext
2+
command:
3+
version: 7
4+
spokenForm: change previous pair
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: relativeScope
11+
scopeType: {type: surroundingPair, delimiter: any}
12+
offset: 1
13+
length: 1
14+
direction: backward
15+
usePrePhraseSnapshot: false
16+
initialState:
17+
documentContents: |-
18+
(
19+
()
20+
21+
)
22+
selections:
23+
- anchor: {line: 2, character: 4}
24+
active: {line: 2, character: 4}
25+
marks: {}
26+
finalState:
27+
documentContents: |-
28+
(
29+
30+
31+
)
32+
selections:
33+
- anchor: {line: 1, character: 4}
34+
active: {line: 1, character: 4}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
languageId: typescript
2+
command:
3+
version: 7
4+
spokenForm: change previous state
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: relativeScope
11+
scopeType: {type: statement}
12+
offset: 1
13+
length: 1
14+
direction: backward
15+
usePrePhraseSnapshot: false
16+
initialState:
17+
documentContents: |-
18+
const b = 2;
19+
if (true) {
20+
const a = 1;
21+
}
22+
selections:
23+
- anchor: {line: 3, character: 1}
24+
active: {line: 3, character: 1}
25+
marks: {}
26+
finalState:
27+
documentContents: |-
28+
29+
if (true) {
30+
const a = 1;
31+
}
32+
selections:
33+
- anchor: {line: 0, character: 0}
34+
active: {line: 0, character: 0}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
languageId: typescript
2+
command:
3+
version: 7
4+
spokenForm: change previous state
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: relativeScope
11+
scopeType: {type: statement}
12+
offset: 1
13+
length: 1
14+
direction: backward
15+
usePrePhraseSnapshot: false
16+
initialState:
17+
documentContents: |-
18+
if (true) {
19+
const a = 1;
20+
21+
}
22+
selections:
23+
- anchor: {line: 2, character: 3}
24+
active: {line: 2, character: 3}
25+
marks: {}
26+
finalState:
27+
documentContents: |-
28+
if (true) {
29+
30+
31+
}
32+
selections:
33+
- anchor: {line: 1, character: 3}
34+
active: {line: 1, character: 3}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
languageId: typescript
2+
command:
3+
version: 7
4+
spokenForm: change previous state
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: relativeScope
11+
scopeType: {type: statement}
12+
offset: 1
13+
length: 1
14+
direction: backward
15+
usePrePhraseSnapshot: false
16+
initialState:
17+
documentContents: |-
18+
const b = 2;
19+
if (true) {
20+
const a = 1;
21+
}
22+
else if (false) {
23+
24+
}
25+
selections:
26+
- anchor: {line: 5, character: 3}
27+
active: {line: 5, character: 3}
28+
marks: {}
29+
finalState:
30+
documentContents: |-
31+
32+
if (true) {
33+
const a = 1;
34+
}
35+
else if (false) {
36+
37+
}
38+
selections:
39+
- anchor: {line: 0, character: 0}
40+
active: {line: 0, character: 0}

0 commit comments

Comments
 (0)