Add "Open Containing Folder" etc to file context menu in Git SCM view (#149150)
* Add "Open Containing Folder" etc to file context menu in Git SCM view Caption is "Reveal in Finder" on macOS and "Reveal in File Explorer" on Windows. This resolves #137828 * Use multiple decorators on a method to simplify codepull/149437/head
parent
81e412cf52
commit
479abbf95e
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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<void> {
|
||||
if (!resourceState) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(resourceState.resourceUri instanceof Uri)) {
|
||||
return;
|
||||
}
|
||||
|
||||
await commands.executeCommand('revealFileInOS', resourceState.resourceUri);
|
||||
}
|
||||
|
||||
private async _stash(repository: Repository, includeUntracked = false): Promise<void> {
|
||||
const noUnstagedChanges = repository.workingTreeGroup.resourceStates.length === 0
|
||||
&& (!includeUntracked || repository.untrackedGroup.resourceStates.length === 0);
|
||||
|
|
Loading…
Reference in New Issue