Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Infer gopath correctly when no folder is opened
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Jan 22, 2019
1 parent b44bb8a commit 58817b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,11 @@ export function substituteEnv(input: string): string {

export function getCurrentGoPath(workspaceUri?: vscode.Uri): string {
let currentFilePath: string;
if (vscode.window.activeTextEditor && vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri)) {
workspaceUri = workspaceUri || vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri).uri;
if (vscode.window.activeTextEditor) {
currentFilePath = vscode.window.activeTextEditor.document.uri.fsPath;
if (!workspaceUri && vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri)) {
workspaceUri = vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri).uri;
}
}
const config = vscode.workspace.getConfiguration('go', workspaceUri);
let currentRoot = workspaceUri ? workspaceUri.fsPath : vscode.workspace.rootPath;
Expand Down

0 comments on commit 58817b8

Please sign in to comment.