File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ A Visual Studio Code extension for [cht.sh](https://cht.sh/).
2727 - ${index} - the index of the snippet (e.g. 2 for the third answer)
2828- ` insertWithDoubleClick ` : insert snippet with double click.
2929- ` showCopySuccessNotification ` : Whether to show a notification after the snippet is copied to the clipboard.
30+ - ` saveBackups ` : Whether to create backups of the snippets.
3031
3132## Installation
3233
Original file line number Diff line number Diff line change 171171 "type" : " boolean" ,
172172 "default" : true ,
173173 "description" : " Whether to show a notification after the snippet is copied to the clipboard."
174+ },
175+ "snippet.saveBackups" : {
176+ "type" : " boolean" ,
177+ "default" : true ,
178+ "description" : " Whether to create backups of the snippets."
174179 }
175180 }
176181 },
Original file line number Diff line number Diff line change 11import { randomUUID } from "crypto" ;
22import * as vscode from "vscode" ;
3+ import { getConfig } from "./config" ;
34import { formatUnixTime } from "./date" ;
45import SnippetsStorage , { TreeElement } from "./snippetsStorage" ;
56
@@ -83,6 +84,10 @@ export class BackupManager {
8384 }
8485
8586 private async makeBackup ( elements : TreeElement [ ] , operation ?: string ) {
87+ if ( ! getConfig ( "saveBackups" ) ) {
88+ return ;
89+ }
90+
8691 const backup : Backup = {
8792 id : randomUUID ( ) ,
8893 dateUnix : Date . now ( ) ,
You can’t perform that action at this time.
0 commit comments