This is a Visual Studio Code extension that formats git commit messages in the source control input box according to the 50/72 rule. It also supports optional linting and quick fixes for missing type:
subject line prefixes.
-
Install the extension in VS Code.
-
Write a commit message in the source control view input box.
-
If either the subject line or the body exceeds the configured limit, a validation message will appear in the source control input box. Use the Quick Fix command (
Ctrl+.
) to access and run theFormat commit message
code action. -
If your commit message lacks a
type:
prefix, a validation message will appear in the source control input box. Use the Quick Fix command (Ctrl+.
) to access and run theAdd commit type
code action. -
Happy committing!
- Configure how long your commit message subject lines and bodies should be with the following settings:
git.inputValidationSubjectLength
(default: 50 chars)git.inputValidationLength
(default: 72 chars)
- Enable
editor.formatOnType
to automatically format your commit message when you insert a newline. - Configure how overly long subject lines should wrap when formatted with
gitCommit.subjectLine.overflowStrategy
(default:split
) - Configure whether you want validation and quick fixes for commit types in the subject line:
gitCommit.subjectLine.lint.enabled
: (default:false
)gitCommit.subjectLine.lint.types
(default:feat:
,fix:
and other Conventional Commit types)
- Configure whether you want the formatter to strip multiple successive newlines:
gitCommit.collapseMultipleEmptyLines.enabled
(default:false
)
- Node.js
- Visual Studio Code
- Clone the repository.
- Run
npm install
to install the dependencies. - Open the project in VS Code.
Press F5
to compile the extension source code and launch the extension development host.
Run npm test
to run the tests.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.