From 8abfb94806964e319668033764fc4cb1c9123c79 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Mon, 9 Jan 2017 10:41:33 +0100 Subject: [PATCH] git: clean command --- extensions/git/package.json | 58 ++++++++++++++++--- extensions/git/resources/icons/dark/clean.svg | 1 + .../git/resources/icons/light/clean.svg | 1 + extensions/git/src/commands.ts | 15 ++++- 4 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 extensions/git/resources/icons/dark/clean.svg create mode 100644 extensions/git/resources/icons/light/clean.svg diff --git a/extensions/git/package.json b/extensions/git/package.json index 3d00bb23494..0e74a3a51d8 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -31,10 +31,15 @@ } }, { - "command": "git.open", + "command": "git.openChange", "title": "Open Change", "category": "Git" }, + { + "command": "git.openFile", + "title": "Open File", + "category": "Git" + }, { "command": "git.stage", "title": "Stage", @@ -70,6 +75,15 @@ "light": "resources/icons/light/unstage.svg", "dark": "resources/icons/dark/unstage.svg" } + }, + { + "command": "git.clean", + "title": "Clean", + "category": "Git", + "icon": { + "light": "resources/icons/light/clean.svg", + "dark": "resources/icons/dark/clean.svg" + } } ], "menus": { @@ -102,22 +116,52 @@ ], "scm/resource/context": [ { - "command": "git.unstage", + "command": "git.openChange", + "when": "scmProvider == git && scmResourceGroup == index" + }, + { + "command": "git.openFile", "when": "scmProvider == git && scmResourceGroup == index" }, { "command": "git.unstage", - "group": "inline", - "when": "scmProvider == git && scmResourceGroup == index" + "when": "scmProvider == git && scmResourceGroup == index", + "group": "1_modification" + }, + { + "command": "git.unstage", + "when": "scmProvider == git && scmResourceGroup == index", + "group": "inline" + }, + { + "command": "git.openChange", + "when": "scmProvider == git && scmResourceGroup == workingTree", + "group": "navigation" + }, + { + "command": "git.openFile", + "when": "scmProvider == git && scmResourceGroup == workingTree", + "group": "navigation" }, { "command": "git.stage", - "when": "scmProvider == git && scmResourceGroup == workingTree" + "when": "scmProvider == git && scmResourceGroup == workingTree", + "group": "1_modification" + }, + { + "command": "git.clean", + "when": "scmProvider == git && scmResourceGroup == workingTree", + "group": "1_modification" + }, + { + "command": "git.clean", + "when": "scmProvider == git && scmResourceGroup == workingTree", + "group": "inline" }, { "command": "git.stage", - "group": "inline", - "when": "scmProvider == git && scmResourceGroup == workingTree" + "when": "scmProvider == git && scmResourceGroup == workingTree", + "group": "inline" } ] }, diff --git a/extensions/git/resources/icons/dark/clean.svg b/extensions/git/resources/icons/dark/clean.svg new file mode 100644 index 00000000000..9f175633389 --- /dev/null +++ b/extensions/git/resources/icons/dark/clean.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/git/resources/icons/light/clean.svg b/extensions/git/resources/icons/light/clean.svg new file mode 100644 index 00000000000..1fa6ba48a19 --- /dev/null +++ b/extensions/git/resources/icons/light/clean.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 20ec1a761e2..3e48f10ffeb 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -16,7 +16,11 @@ function refresh(model: Model): () => void { }; } -function open(...args: any[]): void { +function openChange(...args: any[]): void { + console.log('open', args); +} + +function openFile(...args: any[]): void { console.log('open', args); } @@ -36,14 +40,21 @@ function unstageAll(resourceGroup: SCMResourceGroup): void { log('unstage-all', resourceGroup); } +function clean(resource: SCMResource): void { + log('clean', resource); +} + + export function registerCommands(model: Model): Disposable { const disposables = [ commands.registerCommand('git.refresh', refresh(model)), + commands.registerCommand('git.openChange', openChange), + commands.registerCommand('git.openFile', openFile), commands.registerCommand('git.stage', stage), commands.registerCommand('git.stage-all', stageAll), commands.registerCommand('git.unstage', unstage), commands.registerCommand('git.unstage-all', unstageAll), - commands.registerCommand('git.open', open) + commands.registerCommand('git.clean', clean), ]; return Disposable.from(...disposables);