diff --git a/extensions/git/package.json b/extensions/git/package.json index db9c80d4718..10d4faf8d63 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -459,6 +459,21 @@ "title": "%command.revealInExplorer%", "category": "Git" }, + { + "command": "git.revealFileInOS.linux", + "title": "%command.revealFileInOS.linux%", + "category": "Git" + }, + { + "command": "git.revealFileInOS.mac", + "title": "%command.revealFileInOS.mac%", + "category": "Git" + }, + { + "command": "git.revealFileInOS.windows", + "title": "%command.revealFileInOS.windows%", + "category": "Git" + }, { "command": "git.stashIncludeUntracked", "title": "%command.stashIncludeUntracked%", @@ -761,6 +776,18 @@ "command": "git.revealInExplorer", "when": "false" }, + { + "command": "git.revealFileInOS.linux", + "when": "false" + }, + { + "command": "git.revealFileInOS.mac", + "when": "false" + }, + { + "command": "git.revealFileInOS.windows", + "when": "false" + }, { "command": "git.undoCommit", "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0" @@ -1211,7 +1238,22 @@ { "command": "git.revealInExplorer", "when": "scmProvider == git && scmResourceGroup == merge", - "group": "2_view" + "group": "2_view@1" + }, + { + "command": "git.revealFileInOS.linux", + "when": "scmProvider == git && scmResourceGroup == merge && isLinux", + "group": "2_view@2" + }, + { + "command": "git.revealFileInOS.mac", + "when": "scmProvider == git && scmResourceGroup == merge && isMac", + "group": "2_view@2" + }, + { + "command": "git.revealFileInOS.windows", + "when": "scmProvider == git && scmResourceGroup == merge && isWindows", + "group": "2_view@2" }, { "command": "git.openFile2", @@ -1251,7 +1293,22 @@ { "command": "git.revealInExplorer", "when": "scmProvider == git && scmResourceGroup == index", - "group": "2_view" + "group": "2_view@1" + }, + { + "command": "git.revealFileInOS.linux", + "when": "scmProvider == git && scmResourceGroup == index && isLinux", + "group": "2_view@2" + }, + { + "command": "git.revealFileInOS.mac", + "when": "scmProvider == git && scmResourceGroup == index && isMac", + "group": "2_view@2" + }, + { + "command": "git.revealFileInOS.windows", + "when": "scmProvider == git && scmResourceGroup == index && isWindows", + "group": "2_view@2" }, { "command": "git.openFile2", @@ -1316,7 +1373,22 @@ { "command": "git.revealInExplorer", "when": "scmProvider == git && scmResourceGroup == workingTree", - "group": "2_view" + "group": "2_view@1" + }, + { + "command": "git.revealFileInOS.linux", + "when": "scmProvider == git && scmResourceGroup == workingTree && isLinux", + "group": "2_view@2" + }, + { + "command": "git.revealFileInOS.mac", + "when": "scmProvider == git && scmResourceGroup == workingTree && isMac", + "group": "2_view@2" + }, + { + "command": "git.revealFileInOS.windows", + "when": "scmProvider == git && scmResourceGroup == workingTree && isWindows", + "group": "2_view@2" }, { "command": "git.openChange", diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 10c030fb034..0562d14e52e 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -80,6 +80,9 @@ "command.showOutput": "Show Git Output", "command.ignore": "Add to .gitignore", "command.revealInExplorer": "Reveal in Explorer View", + "command.revealFileInOS.linux": "Open Containing Folder", + "command.revealFileInOS.mac": "Reveal in Finder", + "command.revealFileInOS.windows": "Reveal in File Explorer", "command.rebaseAbort": "Abort Rebase", "command.stashIncludeUntracked": "Stash (Include Untracked)", "command.stash": "Stash", diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 790f21439eb..3864142817c 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -2546,6 +2546,21 @@ export class CommandCenter { await commands.executeCommand('revealInExplorer', resourceState.resourceUri); } + @command('git.revealFileInOS.linux') + @command('git.revealFileInOS.mac') + @command('git.revealFileInOS.windows') + async revealFileInOS(resourceState: SourceControlResourceState): Promise { + if (!resourceState) { + return; + } + + if (!(resourceState.resourceUri instanceof Uri)) { + return; + } + + await commands.executeCommand('revealFileInOS', resourceState.resourceUri); + } + private async _stash(repository: Repository, includeUntracked = false): Promise { const noUnstagedChanges = repository.workingTreeGroup.resourceStates.length === 0 && (!includeUntracked || repository.untrackedGroup.resourceStates.length === 0);