Skip to content

wtho/vscode-commit-pro

Repository files navigation


CommitPro Logo

CommitPro lets you write your Commit Messages like a pro - like you write your Code.

CommitPro

CommitPro is an open-source extension for Visual Studio Code.

CommitPro helps you writing better git commit messages. As opposed to existing solutions, it runs and validates while you write your message and immediately shows you problems and provides fixes and completions. The extension runs as Language Server in an own process to support you using the full IDE features set like when your write code in a programming language.

Here are the features that CommitPro provides:

Usage

You can start composing your commit message using the extension through the following ways:

  • Set the IDE as your default commit editor in git. This can be done using the git command git config --global core.editor "code --wait". If you then use git commit or git commit --amend in your command line, your current vscode editor will open the commit message.
  • Use the Magic Wand button in the Source Control View
  • Invoke the commands from the Command Palette
    • Git: Commit Message in Code Editor for regular commits
    • Git: Amend Commit Message in Code Editor for amending commits
  • Define a keyboard shortcut for the commands
    • commitPro.editor.command.openEditor for regular commits
    • commitPro.editor.command.openEditorAmend for amending commits

Features

Syntax Highlighting #

CommitPro uses its own commit message parser, which turns the message into an Abstract Syntax Tree (AST). This allows the extension to locate all parts of the message at any time and tell the IDE where to apply highlighting. It uses the Semantic Highlighting feature, which is slower than conventional highlighting, but allows more complex, context-based highlighting.

Opt-In #

In case your Syntax Highlighting is not working, you might use a theme which does not support semantic highlighting out of the box. In this case you can opt-in in your vscode-configuration. Use the Preferences: Open Settings command to edit your settings.json and add the following entry:

"[git-commit]": { "editor.semanticHighlighting.enabled": true }

Commitlint Support #

You can configure CommitPro using commitlint configuration files. While commitlint is a JS-based library, CommitPro will pick up your json or yaml configuration, if you work with a non-JavaScript project.

If you want to tweak the validation to your liking, you can start with this example .commitlintrc.json file and take a look at the rules supported by commitlint:

{ 
  "extends": ["@commitlint/config-conventional"],
  "rules": {
    "type-enum": [
      2,
      "always",
      [
        "feat",
        "fix",
        "ci",
        "chore",
        "docs",
        "perf",
        "refactor",
        "revert",
        "style",
        "test"
      ]
    ]
  }
}

Rule Reference

If you want your team to follow common guidelines, make sure you commit the configuration file and add CommitPro to recommended extension for this codebase.

Autocompletion #

According to your configuration and commits in your git history, CommitPro will provide completions for certain parts of your commit message.

Quick Fixes #

If not following your ruleset or the conventional commit format, CommitPro will provide quick fix actions to your IDE so you can quickly correct your message before committing.

History Introspection #

CommitPro takes a deep look into your git history to adapt to patterns and keeping your message style consistent with previous commits.

Planned Features

Take a look at the GitHub Issues to get an overview of what features will be developed next.