Skip to content

Commit fbb31f1

Browse files
committed
Remove undesirable pairs
1 parent 8b341fa commit fbb31f1

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

packages/cursorless-engine/src/scopeProviders/ScopeInfoProvider.ts

+17-7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { ScopeTypeInfo, ScopeTypeInfoEventCallback } from "..";
1313

1414
import { CustomSpokenFormGenerator } from "../generateSpokenForm/CustomSpokenFormGenerator";
1515
import { scopeTypeToString } from "./scopeTypeToString";
16+
import { SpeakableSurroundingPairName } from "../SpokenFormMap";
1617

1718
export const spokenFormsPath = path.join(
1819
homedir(),
@@ -68,7 +69,7 @@ export class ScopeInfoProvider {
6869
private updateScopeTypeInfos(): void {
6970
const scopeTypes: ScopeType[] = [
7071
...simpleScopeTypeTypes
71-
// Ignore instance pseudo-scope for now
72+
// Ignore instance pseudo-scope because it's not really a scope
7273
// Skip "string" because we use surrounding pair for that
7374
.filter(
7475
(scopeTypeType) =>
@@ -78,12 +79,21 @@ export class ScopeInfoProvider {
7879
type: scopeTypeType,
7980
})),
8081

81-
...surroundingPairNames.map(
82-
(surroundingPairName): SurroundingPairScopeType => ({
83-
type: "surroundingPair",
84-
delimiter: surroundingPairName,
85-
}),
86-
),
82+
...surroundingPairNames
83+
.filter(
84+
(
85+
surroundingPairName,
86+
): surroundingPairName is Exclude<
87+
SpeakableSurroundingPairName,
88+
"whitespace"
89+
> => surroundingPairName !== "collectionBoundary",
90+
)
91+
.map(
92+
(surroundingPairName): SurroundingPairScopeType => ({
93+
type: "surroundingPair",
94+
delimiter: surroundingPairName,
95+
}),
96+
),
8797

8898
...this.customSpokenFormGenerator.getCustomRegexScopeTypes(),
8999
];

0 commit comments

Comments
 (0)