diff --git a/CHANGELOG.md b/CHANGELOG.md index 97a7bca..3c59e90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Fixed +- Fixes issue where `Open File` command failed for in many instances (for GitUri resources) ## [5.6.1] - 2017-10-11 ### Fixed diff --git a/src/commands/common.ts b/src/commands/common.ts index 417dc34..3a76153 100644 --- a/src/commands/common.ts +++ b/src/commands/common.ts @@ -1,7 +1,7 @@ 'use strict'; import { commands, Disposable, SourceControlResourceGroup, SourceControlResourceState, TextDocumentShowOptions, TextEditor, TextEditorEdit, Uri, window, workspace } from 'vscode'; import { ExplorerNode } from '../views/explorerNodes'; -import { GitBranch, GitCommit, GitRemote } from '../gitService'; +import { GitBranch, GitCommit, GitRemote, GitUri } from '../gitService'; import { Logger } from '../logger'; import { Telemetry } from '../telemetry'; @@ -277,6 +277,10 @@ export async function openEditor(uri: Uri, options?: TextDocumentShowOptions): P viewColumn: (window.activeTextEditor && window.activeTextEditor.viewColumn) || 1 }; + if (uri instanceof GitUri) { + uri = Uri.file(uri.fsPath); + } + const document = await workspace.openTextDocument(uri); return window.showTextDocument(document, { ...defaults, ...(options || {}) }); }