Skip to content

Commit 0874703

Browse files
Added every scopes
1 parent d5df491 commit 0874703

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

packages/cursorless-vscode-e2e/src/suite/performance.vscode.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const testData = generateTestData(100);
1515
const smallThresholdMs = 100;
1616
const largeThresholdMs = 500;
1717

18-
type ModifierType = "previous";
18+
type ModifierType = "containing" | "previous" | "every";
1919

2020
suite("Performance", async function () {
2121
endToEndTestSetup(this);
@@ -59,6 +59,8 @@ suite("Performance", async function () {
5959
// Parse tree based, relative scope
6060
["collectionKey", largeThresholdMs, "previous"],
6161
["value", largeThresholdMs, "previous"],
62+
["collectionKey", largeThresholdMs, "every"],
63+
["value", largeThresholdMs, "every"],
6264
// Text based, but utilizes surrounding pair
6365
["boundedParagraph", largeThresholdMs],
6466
["boundedNonWhitespaceSequence", largeThresholdMs],
@@ -71,6 +73,7 @@ suite("Performance", async function () {
7173
largeThresholdMs,
7274
"previous",
7375
],
76+
[{ type: "surroundingPair", delimiter: "any" }, largeThresholdMs, "every"],
7477
];
7578

7679
for (const [scope, threshold, modifierType] of fixtures) {
@@ -98,7 +101,7 @@ async function removeToken(thresholdMs: number) {
98101
async function selectScopeType(
99102
scopeType: ScopeType,
100103
thresholdMs: number,
101-
modifierType?: ModifierType,
104+
modifierType: ModifierType = "containing",
102105
) {
103106
await testPerformance(thresholdMs, {
104107
name: "setSelection",
@@ -111,9 +114,13 @@ async function selectScopeType(
111114

112115
function getModifier(
113116
scopeType: ScopeType,
114-
modifierType?: ModifierType,
117+
modifierType: ModifierType,
115118
): Modifier {
116119
switch (modifierType) {
120+
case "containing":
121+
return { type: "containingScope", scopeType };
122+
case "every":
123+
return { type: "everyScope", scopeType };
117124
case "previous":
118125
return {
119126
type: "relativeScope",
@@ -122,8 +129,6 @@ function getModifier(
122129
length: 1,
123130
scopeType,
124131
};
125-
default:
126-
return { type: "containingScope", scopeType };
127132
}
128133
}
129134

0 commit comments

Comments
 (0)