diff --git a/extensions/git/package.json b/extensions/git/package.json index f8db532ae72..0a35bf62056 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -1107,6 +1107,11 @@ "default": "warn", "description": "%config.inputValidation%" }, + "git.inputValidationLength": { + "type": "number", + "default": 72, + "description": "%config.inputValidationLength%" + }, "git.detectSubmodules": { "type": "boolean", "scope": "resource", diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 216d1d609b8..b87fb550b74 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -66,7 +66,6 @@ "config.autoRepositoryDetection.openEditors": "Scan for parent folders of open files.", "config.autorefresh": "Whether auto refreshing is enabled.", "config.autofetch": "Whether auto fetching is enabled.", - "config.enableLongCommitWarning": "Whether long commit messages should be warned about.", "config.confirmSync": "Confirm before synchronizing git repositories.", "config.countBadge": "Controls the git badge counter.", "config.countBadge.all": "Count all changes.", @@ -91,6 +90,7 @@ "config.showInlineOpenFileAction": "Controls whether to show an inline Open File action in the Git changes view.", "config.showPushSuccessNotification": "Controls whether to show a notification when a push is successful.", "config.inputValidation": "Controls when to show commit message input validation.", + "config.inputValidationLength": "Controls the commit message length threshold for showing a warning.", "config.detectSubmodules": "Controls whether to automatically detect git submodules.", "config.detectSubmodulesLimit": "Controls the limit of git submodules detected.", "config.alwaysShowStagedChangesResourceGroup": "Always show the Staged Changes resource group.", diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index 978767ce331..9f8a4eb4330 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -456,8 +456,6 @@ class ProgressManager { export class Repository implements Disposable { - private static readonly InputValidationLength = 72; - private _onDidChangeRepository = new EventEmitter(); readonly onDidChangeRepository: Event = this._onDidChangeRepository.event; @@ -669,19 +667,20 @@ export class Repository implements Disposable { end = match ? match.index : text.length; const line = text.substring(start, end); + const threshold = Math.max(config.get('inputValidationLength') || 72, 0) || 72; - if (line.length <= Repository.InputValidationLength) { + if (line.length <= threshold) { if (setting !== 'always') { return; } return { - message: localize('commitMessageCountdown', "{0} characters left in current line", Repository.InputValidationLength - line.length), + message: localize('commitMessageCountdown', "{0} characters left in current line", threshold - line.length), type: SourceControlInputBoxValidationType.Information }; } else { return { - message: localize('commitMessageWarning', "{0} characters over {1} in current line", line.length - Repository.InputValidationLength, Repository.InputValidationLength), + message: localize('commitMessageWarning', "{0} characters over {1} in current line", line.length - threshold, threshold), type: SourceControlInputBoxValidationType.Warning }; }