Skip to content

Commit 7ab6cc5

Browse files
committed
src/goExplorer.ts: create opened files if they do not exist
For #2049 Change-Id: Iaa4c5cf67d44f97f8fe4bd0e49a897cc5d4d9624 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/391256 Trust: Jamal Carvalho <[email protected]> Run-TryBot: Jamal Carvalho <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]> TryBot-Result: kokoro <[email protected]>
1 parent b0d47a8 commit 7ab6cc5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/goExplorer.ts

+3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ export class GoExplorerProvider implements vscode.TreeDataProvider<vscode.TreeIt
8282

8383
private async open(item: EnvTreeItem) {
8484
if (typeof item.file === 'undefined') return;
85+
const edit = new vscode.WorkspaceEdit();
86+
edit.createFile(item.file, { ignoreIfExists: true });
87+
await vscode.workspace.applyEdit(edit);
8588
const doc = await vscode.workspace.openTextDocument(item.file);
8689
await vscode.window.showTextDocument(doc);
8790
}

0 commit comments

Comments
 (0)