提交 ef3c40b6 编写于 作者: J Joao Moreno

Merge branch 'Duroktar-feature-git-open-old-file'

......@@ -59,6 +59,11 @@
"dark": "resources/icons/dark/open-file.svg"
}
},
{
"command": "git.openHEADFile",
"title": "%command.openHEADFile%",
"category": "Git"
},
{
"command": "git.stage",
"title": "%command.stage%",
......@@ -246,6 +251,10 @@
"command": "git.openFile",
"when": "config.git.enabled && scmProvider == git && gitState == idle"
},
{
"command": "git.openHEADFile",
"when": "config.git.enabled && scmProvider == git && gitState == idle"
},
{
"command": "git.openChange",
"when": "config.git.enabled && scmProvider == git && gitState == idle"
......@@ -513,6 +522,11 @@
"when": "config.git.enabled && scmProvider == git && gitState == idle && scmResourceGroup == index",
"group": "navigation"
},
{
"command": "git.openHEADFile",
"when": "config.git.enabled && scmProvider == git && gitState == idle && scmResourceGroup == index",
"group": "navigation"
},
{
"command": "git.unstage",
"when": "config.git.enabled && scmProvider == git && gitState == idle && scmResourceGroup == index",
......@@ -528,6 +542,11 @@
"when": "config.git.enabled && scmProvider == git && gitState == idle && scmResourceGroup == workingTree",
"group": "navigation"
},
{
"command": "git.openHEADFile",
"when": "config.git.enabled && scmProvider == git && gitState == idle && scmResourceGroup == workingTree",
"group": "navigation"
},
{
"command": "git.openFile",
"when": "config.git.enabled && scmProvider == git && gitState == idle && scmResourceGroup == workingTree",
......
......@@ -4,6 +4,7 @@
"command.refresh": "Refresh",
"command.openChange": "Open Changes",
"command.openFile": "Open File",
"command.openHEADFile": "Open File (HEAD)",
"command.stage": "Stage Changes",
"command.stageAll": "Stage All Changes",
"command.stageSelectedRanges": "Stage Selected Ranges",
......
......@@ -313,6 +313,32 @@ export class CommandCenter {
return await commands.executeCommand<void>('vscode.open', uri, viewColumn);
}
@command('git.openHEADFile')
async openHEADFile(arg?: Resource | Uri): Promise<void> {
let resource: Resource | undefined = undefined;
if (arg instanceof Resource) {
resource = arg;
} else if (arg instanceof Uri) {
resource = this.getSCMResource(arg);
} else {
resource = this.getSCMResource();
}
if (!resource) {
return;
}
const HEAD = this.getLeftResource(resource);
if (!HEAD) {
window.showWarningMessage(localize('HEAD not available', "HEAD version of '{0}' is not available.", path.basename(resource.resourceUri.fsPath)));
return;
}
return await commands.executeCommand<void>('vscode.open', HEAD);
}
@command('git.openChange')
async openChange(arg?: Resource | Uri): Promise<void> {
let resource: Resource | undefined = undefined;
......@@ -328,7 +354,6 @@ export class CommandCenter {
if (!resource) {
return;
}
return await this._openResource(resource);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册