Fixes uris on nodes

This commit is contained in:
Eric Amodio
2017-06-26 03:14:17 -04:00
parent d193676502
commit c96a659e9e
9 changed files with 28 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
'use strict';
import { commands, Event, EventEmitter, ExtensionContext, TreeDataProvider, TreeItem, Uri, window } from 'vscode';
import { commands, Event, EventEmitter, ExtensionContext, TreeDataProvider, TreeItem, Uri } from 'vscode';
import { UriComparer } from '../comparers';
import { ExplorerNode, FileHistoryNode, RepositoryNode, ResourceType, StashNode } from './explorerNodes';
import { GitService, GitUri } from '../gitService';
@@ -18,12 +18,13 @@ export class GitExplorer implements TreeDataProvider<ExplorerNode> {
constructor(private context: ExtensionContext, private git: GitService) {
commands.registerCommand('gitlens.gitExplorer.refresh', () => this.refresh());
const editor = window.activeTextEditor;
// const editor = window.activeTextEditor;
const uri = (editor !== undefined && editor.document !== undefined)
? new GitUri(editor.document.uri, { repoPath: git.repoPath, fileName: editor.document.uri.fsPath })
: new GitUri(Uri.file(git.repoPath), { repoPath: git.repoPath, fileName: git.repoPath });
// const uri = (editor !== undefined && editor.document !== undefined)
// ? new GitUri(editor.document.uri, { repoPath: git.repoPath, fileName: editor.document.uri.fsPath })
// : new GitUri(Uri.file(git.repoPath), { repoPath: git.repoPath, fileName: git.repoPath });
const uri = new GitUri(Uri.file(git.repoPath), { repoPath: git.repoPath, fileName: git.repoPath });
this._roots.push(new RepositoryNode(uri, context, git));
}