提交 91a02c7a 编写于 作者: J Joao Moreno

💄

上级 2f54b000
......@@ -60,8 +60,8 @@
}
},
{
"command": "git.openOldFile",
"title": "%command.openOldFile%",
"command": "git.openHEADFile",
"title": "%command.openHEADFile%",
"category": "Git"
},
{
......@@ -252,7 +252,7 @@
"when": "config.git.enabled && scmProvider == git && gitState == idle"
},
{
"command": "git.openOldFile",
"command": "git.openHEADFile",
"when": "config.git.enabled && scmProvider == git && gitState == idle"
},
{
......@@ -523,7 +523,7 @@
"group": "navigation"
},
{
"command": "git.openOldFile",
"command": "git.openHEADFile",
"when": "config.git.enabled && scmProvider == git && gitState == idle && scmResourceGroup == index",
"group": "navigation"
},
......@@ -543,7 +543,7 @@
"group": "navigation"
},
{
"command": "git.openOldFile",
"command": "git.openHEADFile",
"when": "config.git.enabled && scmProvider == git && gitState == idle && scmResourceGroup == workingTree",
"group": "navigation"
},
......
......@@ -4,7 +4,7 @@
"command.refresh": "Refresh",
"command.openChange": "Open Changes",
"command.openFile": "Open File",
"command.openOldFile": "Open Old File",
"command.openHEADFile": "Open File (HEAD)",
"command.stage": "Stage Changes",
"command.stageAll": "Stage All Changes",
"command.stageSelectedRanges": "Stage Selected Ranges",
......
......@@ -313,13 +313,12 @@ export class CommandCenter {
return await commands.executeCommand<void>('vscode.open', uri, viewColumn);
}
@command('git.openOldFile')
async openOldFile(arg?: Resource | Uri): Promise<void> {
@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 {
......@@ -329,17 +328,15 @@ export class CommandCenter {
if (!resource) {
return;
}
return await this._openOldResource(resource);
}
private async _openOldResource(resource: Resource): Promise<void> {
const old = this.getLeftResource(resource);
const current = this.getRightResource(resource);
const HEAD = this.getLeftResource(resource);
if (!old) {
return await commands.executeCommand<void>('vscode.open', current);
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', old);
return await commands.executeCommand<void>('vscode.open', HEAD);
}
@command('git.openChange')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册