diff --git a/packages/cursorless-engine/src/actions/snippetsLegacy/InsertSnippetLegacy.ts b/packages/cursorless-engine/src/actions/snippetsLegacy/InsertSnippetLegacy.ts index e65b0e34e2..d4b134d06e 100644 --- a/packages/cursorless-engine/src/actions/snippetsLegacy/InsertSnippetLegacy.ts +++ b/packages/cursorless-engine/src/actions/snippetsLegacy/InsertSnippetLegacy.ts @@ -21,6 +21,7 @@ import { findMatchingSnippetDefinitionStrict, transformSnippetVariables, } from "../snippetsLegacy/snippet"; +import { showLegacySnippetsNotification } from "./legacySnippetsNotification"; import { textFormatters, type TextFormatterName } from "./textFormatters"; export default class InsertSnippetLegacy { @@ -95,6 +96,8 @@ export default class InsertSnippetLegacy { destinations: Destination[], snippetDescription: NamedInsertSnippetArg, ): Promise { + showLegacySnippetsNotification(); + const editor = ide().getEditableTextEditor( ensureSingleEditor(destinations), ); diff --git a/packages/cursorless-engine/src/actions/snippetsLegacy/WrapWithSnippetLegacy.ts b/packages/cursorless-engine/src/actions/snippetsLegacy/WrapWithSnippetLegacy.ts index 5e9c4d1dce..99f094c218 100644 --- a/packages/cursorless-engine/src/actions/snippetsLegacy/WrapWithSnippetLegacy.ts +++ b/packages/cursorless-engine/src/actions/snippetsLegacy/WrapWithSnippetLegacy.ts @@ -14,6 +14,7 @@ import { findMatchingSnippetDefinitionStrict, transformSnippetVariables, } from "../snippetsLegacy/snippet"; +import { showLegacySnippetsNotification } from "./legacySnippetsNotification"; export default class WrapWithSnippetLegacy { private snippetParser = new SnippetParser(); @@ -81,6 +82,8 @@ export default class WrapWithSnippetLegacy { targets: Target[], snippetDescription: NamedWrapWithSnippetArg, ): Promise { + showLegacySnippetsNotification(); + const editor = ide().getEditableTextEditor(ensureSingleEditor(targets)); const body = this.getBody(snippetDescription, targets); diff --git a/packages/cursorless-engine/src/actions/snippetsLegacy/legacySnippetsNotification.ts b/packages/cursorless-engine/src/actions/snippetsLegacy/legacySnippetsNotification.ts new file mode 100644 index 0000000000..45873ff07a --- /dev/null +++ b/packages/cursorless-engine/src/actions/snippetsLegacy/legacySnippetsNotification.ts @@ -0,0 +1,19 @@ +import { showWarning } from "@cursorless/common"; +import { ide } from "../../singletons/ide.singleton"; + +// Show only once per vscode instance +let wasShown = false; + +export function showLegacySnippetsNotification() { + if (wasShown) { + return; + } + + void showWarning( + ide().messages, + "legacySnippets", + "Talon community snippets are now fully supported in Cursorless! Cursorless's experimental snippets are now deprecated, but in most cases we can help you migrate automatically. Update cursorless-talon and say 'cursorless migrate snippets'.", + ); + + wasShown = true; +}