Skip to content
7 changes: 7 additions & 0 deletions packages/common/src/types/TalonSpokenForms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,10 @@ export class NeedsInitialTalonUpdateError extends Error {
this.name = "NeedsInitialTalonUpdateError";
}
}

export class DisabledCustomSpokenFormsError extends Error {
constructor() {
super("Custom spoken forms are not currently supported in this ide");
this.name = "DisabledCustomSpokenFormsError";
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import type { SpokenFormEntry, TalonSpokenForms } from "@cursorless/common";
import {
DisabledCustomSpokenFormsError,
type SpokenFormEntry,
type TalonSpokenForms,
} from "@cursorless/common";

export class DisabledTalonSpokenForms implements TalonSpokenForms {
getSpokenFormEntries(): Promise<SpokenFormEntry[]> {
throw Error("Talon spoken forms are not implemented.");
throw new DisabledCustomSpokenFormsError();
}

onDidChange() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
CustomRegexScopeType,
DisabledCustomSpokenFormsError,
Disposable,
NeedsInitialTalonUpdateError,
Notifier,
Expand Down Expand Up @@ -81,6 +82,8 @@ export class CustomSpokenForms {
if (err instanceof NeedsInitialTalonUpdateError) {
// Handle case where spokenForms.json doesn't exist yet
this.needsInitialTalonUpdate_ = true;
} else if (err instanceof DisabledCustomSpokenFormsError) {
// Do nothing: this ide doesn't currently support custom spoken forms
} else {
console.error("Error loading custom spoken forms", err);
const msg = (err as Error).message.replace(/\.$/, "");
Expand Down