From 83d86b36f2b4df31e9775281bcad94301e366aa5 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Fri, 21 Apr 2017 14:55:52 +0200 Subject: [PATCH] :bug: fixes #21285 --- extensions/git/src/commands.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index eeccf86f2dc..a1fca73b9ae 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -263,12 +263,22 @@ export class CommandCenter { @command('git.openFileFromUri') async openFileFromUri(uri?: Uri): Promise { const resource = this.getSCMResource(uri); + let uriToOpen: Uri | undefined; - if (!resource) { + if (resource) { + uriToOpen = resource.resourceUri; + } else if (uri && uri.scheme === 'git') { + const { path } = fromGitUri(uri); + uriToOpen = Uri.file(path); + } else if (uri && uri.scheme === 'file') { + uriToOpen = uri; + } + + if (!uriToOpen) { return; } - return await commands.executeCommand('vscode.open', resource.resourceUri); + return await commands.executeCommand('vscode.open', uriToOpen); } @command('git.openChangeFromUri') -- GitLab