File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
packages/cursorless-engine/src/actions/snippetsLegacy Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {
2121 findMatchingSnippetDefinitionStrict ,
2222 transformSnippetVariables ,
2323} from "../snippetsLegacy/snippet" ;
24+ import { showLegacySnippetsNotification } from "./legacySnippetsNotification" ;
2425import { textFormatters , type TextFormatterName } from "./textFormatters" ;
2526
2627export default class InsertSnippetLegacy {
@@ -95,6 +96,8 @@ export default class InsertSnippetLegacy {
9596 destinations : Destination [ ] ,
9697 snippetDescription : NamedInsertSnippetArg ,
9798 ) : Promise < ActionReturnValue > {
99+ showLegacySnippetsNotification ( ) ;
100+
98101 const editor = ide ( ) . getEditableTextEditor (
99102 ensureSingleEditor ( destinations ) ,
100103 ) ;
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414 findMatchingSnippetDefinitionStrict ,
1515 transformSnippetVariables ,
1616} from "../snippetsLegacy/snippet" ;
17+ import { showLegacySnippetsNotification } from "./legacySnippetsNotification" ;
1718
1819export default class WrapWithSnippetLegacy {
1920 private snippetParser = new SnippetParser ( ) ;
@@ -81,6 +82,8 @@ export default class WrapWithSnippetLegacy {
8182 targets : Target [ ] ,
8283 snippetDescription : NamedWrapWithSnippetArg ,
8384 ) : Promise < ActionReturnValue > {
85+ showLegacySnippetsNotification ( ) ;
86+
8487 const editor = ide ( ) . getEditableTextEditor ( ensureSingleEditor ( targets ) ) ;
8588
8689 const body = this . getBody ( snippetDescription , targets ) ;
Original file line number Diff line number Diff line change 1+ import { showWarning } from "@cursorless/common" ;
2+ import { ide } from "../../singletons/ide.singleton" ;
3+
4+ // Show only once per vscode instance
5+ let wasShown = false ;
6+
7+ export function showLegacySnippetsNotification ( ) {
8+ if ( wasShown ) {
9+ return ;
10+ }
11+
12+ void showWarning (
13+ ide ( ) . messages ,
14+ "legacySnippets" ,
15+ "Cursorless snippets are deprecated. Please use community snippets. Update to latest cursorless-talon and say 'cursorless migrate snippets'." ,
16+ ) ;
17+
18+ wasShown = true ;
19+ }
You can’t perform that action at this time.
0 commit comments