diff --git a/package-lock.json b/package-lock.json index b2987df..08cae3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "copyrighter", - "version": "0.0.2", + "version": "0.0.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8b2e9a0..e52dbd8 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,11 @@ "type": "string", "default": "", "description": "An optional note that can appear at the end of the default copyright notice." + }, + "copyrighter.newFilesOnly": { + "type": "boolean", + "default": false, + "description": "Inject Copyright notice in new files only" } } } diff --git a/src/configuration.ts b/src/configuration.ts index 98742e4..f6cfecb 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -57,3 +57,7 @@ export function getCopyright(): Copyright { export function getNote(): string { return getConfiguration().get('note') || ''; } + +export function getNewFilesOnly(): Boolean { + return getConfiguration().get('newFilesOnly') || false; +} diff --git a/src/copyright/copyrightService.ts b/src/copyright/copyrightService.ts index 6386024..3e1e10a 100644 --- a/src/copyright/copyrightService.ts +++ b/src/copyright/copyrightService.ts @@ -22,7 +22,7 @@ export function handleCopyrightCheck(editor: vscode.TextEditor | undefined) { if ( editor !== undefined && isSupportedLanguage(editor.document.languageId) && - !hasCopyright(editor.document) + !hasCopyright(editor.document) && (configuration.getNewFilesOnly() ? isNewDocument(editor.document) : true) ) { insertCopyright(editor); }