Giter VIP home page Giter VIP logo

vscode-git-commit-message-editor's Introduction

Git Commit Message Editor

Edit commit messages via VS Code's editor and Autocomplete for Conventional Commits.

Demo

Features

Installation

To install this extension go to View > Extensions and search for git-commit-message-editor. Next click Install and then Reload.

Usage

Editor

You can open the commit message editor by clicking the Edit icon in the repository in the Source Control view.

Demo Editor 1

Or select Open Commit Message Editor from the overflow menu in the repository in the Source Control view.

Or launch Git: Open Commit Message Editor command on the Command Palette.

Demo Editor 2

Type commit messages with IntelliSense feature and then save it. The Source Control Input Box be filled with the message you typed.

Demo Editor 3

If you don't want to close the commit message editor window after saving, change gitCommitMessageEditor.editor.keepAfterSave option to true. Note that auto-focusing to the Source Control view only works with the option is false.

Note: The commit message editor does not actually create a workspace/.git/COMMIT_EDITMSG file. The file IO operations are handled by the VFS (Virtual File System).

IntelliSense

You can trigger IntelliSense in the commit message editor window by typing Ctrl+Space, or by typing the letters.

Also supported in the VS Code as Git editor mode.

Demo IntelliSense Summary 1

All completions conform to Conventional Commits Specification.

Commit Types completion

List of available conventional commit types:

Commit types originally from commitizen/cz-conventional-changelog

Type Title Description
feat Features A new feature
fix Bug Fixes A bug fix
docs Documentation Documentation only changes
style Styles Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
refactor Code Refactoring A code change that neither fixes a bug nor adds a feature
perf Performance Improvements A code change that improves performance
test Tests Adding missing tests or correcting existing tests
build Builds Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
ci Continuous Integrations Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
chore Chores Other changes that don't modify src or test files
revert Reverts Reverts a previous commit
wip Work In Progress A commit that will be squashed later
initial Initial Initial commit

Scopes completion

You can type a scope manually, select one that is saved, or create a new scope by selecting the Create New Scope item in the suggestion list.

Note: If gitCommitMessageEditor.intelliSense.completion.logScopes.enabled option is true, the scope suggestion list also includes the parsed scopes from existing commit history.

Demo IntelliSense Summary 2

The scope allows only words, underscores, hyphens, and dots (can optionally begin with $) and will be saved into workspace/.vscode/settings.json.

Gitmojis completion

Check out available emojis on Gitmoji

You can trigger the gitmoji suggestions by typing a trigger character : (colon).

Demo IntelliSense Summary 3

The gitmojis completion only works in the subject section of the summary and offers the gitmoji suggestions by Commit Type that you typed. If you want to show all gitmoji suggestions, cancel (pressing Esc) the suggestions widget and re-trigger by typing Ctrl+Space follow the : (colon).

Footer Types completion

Also supports the footer type completion.

Demo IntelliSense Footer 1

List of available conventional footer types:

Type Title Description
Closes Referencing issues A code change that related issues to close (for example, Closes #โ€‹133)
Refs Referencing commits A code change that related other commits (for example, Refs: 676104e, a215868)
BREAKING CHANGE Breaking changes A code change that causes other features to fail

Issues completion

You can trigger the issue suggestions by selecting the Closes item in the footer type suggestion list, or by typing a trigger character # (number sign) on the Closes footer line.

Demo IntelliSense Footer 2

The issue suggestions are provided from your remote git hosting service. The issue items suggested are cached, and the caches will be cleared when the editor closed.

Currently, you can use the git hosting service GitHub only. Note that GitHub API allows for up to 60 requests (for fetching issues) per hour. If you'd like to get a higher GitHub API rate limit, you can authenticate with the GitHub authentication (built-in) extension. See GitHub API Rate limiting for more information.

Commits completion

You can trigger the commit suggestions by selecting the Refs item in the footer type suggestion list, or by typing Ctrl+Space on the Refs footer line.

Demo IntelliSense Footer 3

The commit suggestions are provided from your local repository.

Hovers

You can hover over that Type, Scope, and Emojis of the Summary line and Type, Issues, and Commits of the Footer lines.

Demo IntelliSense Hover 1

CodeLens

To select the previous commit message, click the Recent commits... CodeLens link.

Or use the keyboard shortcut Ctrl+Shift+'.

Demo CodeLens 1

The CodeLens link will appear only when no commit message is typed.

Settings

Table of contributed settings (prefix "gitCommitMessageEditor."):

Name Default Description
editor.keepAfterSave false Controls whether the commit message editor tab keep or close, after saving
codeLens.recentCommits.enabled true Controls whether the Recent commits... code lens feature is enabled or not
codeLens.recentCommits.maxItems 32 Specifies the maximum number of commits to show in the quick pick UI
intelliSense.completion.enabled true Controls whether the "Quick suggestions" feature is enabled or not
intelliSense.completion.scopes [] Scopes that user created (Scopes will be saved into workspace/.vscode/settings.json)
intelliSense.completion.logScopes.enabled false Controls whether the scope suggestions include or not the parsed scopes from existing commit history
intelliSense.completion.issues.pageSize 20 Specifies the maximum number of issues per page to show in the suggestions widget
intelliSense.hover.enabled true Controls whether the "Hover" feature is enabled or not

And recommends adding a setting below into your Global or Workspace settings.json, if you want to follow the Git 50/72 rule.

"[git-commit]": {
    "editor.rulers": [
        50,
        72
    ]
}

Issues

If you find any problems using this extension, or you want to propose new features to it, feel free to open an issue on GitHub.

Release Notes

Detailed Release Notes are available here or above Changelog tab.

Attributions

Icon made by Freepik from www.flaticon.com

vscode-git-commit-message-editor's People

Contributors

phoihos avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sirius16

vscode-git-commit-message-editor's Issues

remoteHelper throws on git ssh urls

Hi, nice work with the scopes, it works nicely.

I came across this bug with repositories cloned via ssh, where this line

const uri = vscode.Uri.parse(url);
throws an error, because the url is of the form '[email protected]:user/repository-name', which isn't valid for vscode.Uri.parse and then that throws '[UriError]: Scheme contains illegal characters.'

Ex. if you clone this repo with git clone [email protected]:phoihos/vscode-git-commit-message-editor.git, then the code lens and scope suggestions break.

Multi-root Workspace support

I have a multi-root workspace and no matter where I open the commit editor it always edits the message for the folder defined last in workspace settings.

Get scope completions from existing git history?

Yo,

Instead of the settings.json approach, how about parsing existing commit history for the scope completions? I mean, the scopes are there, I just can never remember them, and adding them to settings is a bit of work.

Also, it would be nice if using the command palette opened the commit editor in the same project as the active file, in multi root projects.

Failed to open message editor with error

Failed to open message editor with an error notification Cannot read properties of null (reading 'rootUri'). The log in the Extension Host is as follows:

Extension Host log
2023-12-18 11:58:05.431 [error] TypeError: Cannot read properties of null (reading 'rootUri')
	at p.OpenEditorCommand.<anonymous> (/home/az/.vscode/extensions/phoihos.git-commit-message-editor-0.6.3/dist/extension.js:2:128095)
	at Generator.next (<anonymous>)
	at /home/az/.vscode/extensions/phoihos.git-commit-message-editor-0.6.3/dist/extension.js:2:127736
	at new Promise (<anonymous>)
	at t (/home/az/.vscode/extensions/phoihos.git-commit-message-editor-0.6.3/dist/extension.js:2:127481)
	at p.OpenEditorCommand.execute (/home/az/.vscode/extensions/phoihos.git-commit-message-editor-0.6.3/dist/extension.js:2:127997)
	at d.h (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:141:140094)
	at d.$executeContributedCommand (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:141:140954)
	at l.S (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:10829)
	at l.Q (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:10595)
	at l.M (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:9685)
	at l.L (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:8764)
	at f.value (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:7567)
	at n.y (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:80:1902)
	at n.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:80:2119)
	at o.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:103:14039)
	at f.value (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:7903)
	at n.y (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:80:1902)
	at n.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:80:2119)
	at o.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:103:14039)
	at MessagePortMain.<anonymous> (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:171:6183)
	at MessagePortMain.emit (node:events:513:28)
	at MessagePortMain.emit (node:domain:489:12)
	at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:367) gitCommitMessageEditor.editor.command.openEditor {"value":"phoihos.git-commit-message-editor","_lower":"phoihos.git-commit-message-editor"}

But after reloading the VSCode window, it works properly.

Possibility of making this extension run on local extension host

Thanks for the awesome work! Currently it needs to be installed on the remote server to work when remote developing. Is it possible to make it run on local extension host so that we don't need to install it every time we do remote developing on different servers?

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.