瀏覽代碼

Fixes openEditor with GitUris

main
Eric Amodio 7 年之前
父節點
當前提交
5cd30ab268
共有 2 個檔案被更改,包括 7 行新增1 行删除
  1. +2
    -0
      CHANGELOG.md
  2. +5
    -1
      src/commands/common.ts

+ 2
- 0
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/). The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] ## [Unreleased]
### Fixed
- Fixes issue where `Open File` command failed for in many instances (for GitUri resources)
## [5.6.1] - 2017-10-11 ## [5.6.1] - 2017-10-11
### Fixed ### Fixed

+ 5
- 1
src/commands/common.ts 查看文件

@ -1,7 +1,7 @@
'use strict'; 'use strict';
import { commands, Disposable, SourceControlResourceGroup, SourceControlResourceState, TextDocumentShowOptions, TextEditor, TextEditorEdit, Uri, window, workspace } from 'vscode'; import { commands, Disposable, SourceControlResourceGroup, SourceControlResourceState, TextDocumentShowOptions, TextEditor, TextEditorEdit, Uri, window, workspace } from 'vscode';
import { ExplorerNode } from '../views/explorerNodes'; import { ExplorerNode } from '../views/explorerNodes';
import { GitBranch, GitCommit, GitRemote } from '../gitService';
import { GitBranch, GitCommit, GitRemote, GitUri } from '../gitService';
import { Logger } from '../logger'; import { Logger } from '../logger';
import { Telemetry } from '../telemetry'; import { Telemetry } from '../telemetry';
@ -277,6 +277,10 @@ export async function openEditor(uri: Uri, options?: TextDocumentShowOptions): P
viewColumn: (window.activeTextEditor && window.activeTextEditor.viewColumn) || 1 viewColumn: (window.activeTextEditor && window.activeTextEditor.viewColumn) || 1
}; };
if (uri instanceof GitUri) {
uri = Uri.file(uri.fsPath);
}
const document = await workspace.openTextDocument(uri); const document = await workspace.openTextDocument(uri);
return window.showTextDocument(document, { ...defaults, ...(options || {}) }); return window.showTextDocument(document, { ...defaults, ...(options || {}) });
} }

Loading…
取消
儲存