git: add commit toolbar menu item

This commit is contained in:
Joao Moreno 2017-01-31 16:47:04 +01:00
parent cc8351eb95
commit 16694c32b8
4 changed files with 28 additions and 5 deletions

View file

@ -97,7 +97,11 @@
{
"command": "git.commit",
"title": "%command.commit%",
"category": "Git"
"category": "Git",
"icon": {
"light": "resources/icons/light/check.svg",
"dark": "resources/icons/dark/check.svg"
}
},
{
"command": "git.commitStaged",
@ -180,6 +184,11 @@
],
"menus": {
"scm/title": [
{
"command": "git.commit",
"group": "navigation",
"when": "scmProvider == git"
},
{
"command": "git.refresh",
"group": "navigation",

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="-2 -2 16 16" enable-background="new -2 -2 16 16"><polygon fill="#C5C5C5" points="9,0 4.5,9 3,6 0,6 3,12 6,12 12,0"/></svg>

After

Width:  |  Height:  |  Size: 194 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><polygon points="5.382,13 2.382,7 6.618,7 7,7.764 9.382,3 13.618,3 8.618,13" fill="#F6F6F6"/><path d="M12 4l-4 8h-2l-2-4h2l1 2 3-6h2z" fill="#424242"/></svg>

After

Width:  |  Height:  |  Size: 220 B

View file

@ -331,10 +331,22 @@ export class CommandCenter {
@CommandCenter.Command('git.commit')
@CommandCenter.CatchErrors
async commit(): Promise<void> {
await this._commit(async () => await window.showInputBox({
placeHolder: localize('commit message', "Commit message"),
prompt: localize('provide commit message', "Please provide a commit message")
}));
const message = this.commitController.message;
const didCommit = await this._commit(async () => {
if (message) {
return message;
}
return await window.showInputBox({
placeHolder: localize('commit message', "Commit message"),
prompt: localize('provide commit message', "Please provide a commit message")
});
});
if (message && didCommit) {
this.commitController.message = '';
}
}
@CommandCenter.Command('git.commitWithInput')