Skip to content

Commit

Permalink
Remove surrounding pairs force direction
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasArvidsson committed Jan 19, 2025
1 parent b248af6 commit 37d9eca
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 36 deletions.
1 change: 0 additions & 1 deletion packages/common/src/types/SpokenFormType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export interface SpokenFormMapKeyTypes {
pairedDelimiter: SpeakableSurroundingPairName;
simpleScopeTypeType: SimpleScopeTypeType;
complexScopeTypeType: "glyph";
surroundingPairForceDirection: "left" | "right";

/**
* These modifier types are spoken by directly saying the spoken form for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,6 @@ export interface SurroundingPairScopeType {
type: "surroundingPair";
delimiter: SurroundingPairName;

/**
* @deprecated Not supported by next-gen surrounding pairs; we don't believe
* anyone uses this
*/
forceDirection?: SurroundingPairDirection;

/**
* If `true`, then only accept pairs where the pair completely contains the
* selection, ie without the edges touching.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ export class PrimitiveTargetSpokenFormGenerator {
case "oneOf":
case "surroundingPairInterior":
throw new NoSpokenFormError(`Scope type '${scopeType.type}'`);

case "glyph":
return [
this.spokenFormMap.complexScopeTypeType.glyph,
Expand All @@ -241,18 +242,9 @@ export class PrimitiveTargetSpokenFormGenerator {
scopeType.character,
),
];
case "surroundingPair": {
const pair = this.spokenFormMap.pairedDelimiter[scopeType.delimiter];
if (scopeType.forceDirection != null) {
return [
this.spokenFormMap.surroundingPairForceDirection[
scopeType.forceDirection
],
pair,
];
}
return pair;
}

case "surroundingPair":
return this.spokenFormMap.pairedDelimiter[scopeType.delimiter];

case "customRegex":
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import type {
SurroundingPairScopeType,
TextEditor,
} from "@cursorless/common";
import { showError, type ScopeType } from "@cursorless/common";
import { type ScopeType } from "@cursorless/common";
import type { LanguageDefinitions } from "../../../../languages/LanguageDefinitions";
import { ide } from "../../../../singletons/ide.singleton";
import { BaseScopeHandler } from "../BaseScopeHandler";
import { compareTargetScopes } from "../compareTargetScopes";
import type { TargetScope } from "../scope.types";
Expand Down Expand Up @@ -35,16 +34,6 @@ export class SurroundingPairScopeHandler extends BaseScopeHandler {
direction: Direction,
hints: ScopeIteratorRequirements,
): Iterable<TargetScope> {
if (this.scopeType.forceDirection != null) {
// DEPRECATED @ 2024-07-01
void showError(
ide().messages,
"deprecatedForceDirection",
"forceDirection is deprecated. If this is important to you please file an issue on the cursorless repo.",
);
return;
}

const delimiterOccurrences = getDelimiterOccurrences(
this.languageDefinitions.get(this.languageId),
editor.document,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,6 @@ export const defaultSpokenFormMapCore: DefaultSpokenFormMapDefinition = {
glyph: "glyph",
},

surroundingPairForceDirection: {
left: "left",
right: "right",
},

simpleModifier: {
excludeInterior: "bounds",
toRawSelection: "just",
Expand Down

0 comments on commit 37d9eca

Please sign in to comment.