From b25dc0c55cf81ea8544489579079927da671e9f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Wiesmu=CC=88ller?= Date: Wed, 14 Feb 2018 15:16:50 +0100 Subject: [PATCH 1/2] Switch to testfile if already open/visible instead of reopening cc #610 --- src/goGenerateTests.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/goGenerateTests.ts b/src/goGenerateTests.ts index f1c3f4bf5..83e2ab2e5 100644 --- a/src/goGenerateTests.ts +++ b/src/goGenerateTests.ts @@ -55,6 +55,12 @@ export function toggleTestFile(): void { } else { targetFilePath = currentFilePath.substr(0, currentFilePath.lastIndexOf('.go')) + '_test.go'; } + for (let doc of vscode.window.visibleTextEditors) { + if (doc.document.fileName === targetFilePath) { + vscode.commands.executeCommand('vscode.open', vscode.Uri.file(targetFilePath), doc.viewColumn); + return + } + } vscode.commands.executeCommand('vscode.open', vscode.Uri.file(targetFilePath)); } From 5a51543b276b96acb8525c5f63ee2fad3390de42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Wiesmu=CC=88ller?= Date: Wed, 14 Feb 2018 20:24:15 +0100 Subject: [PATCH 2/2] Fix syntax error --- src/goGenerateTests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/goGenerateTests.ts b/src/goGenerateTests.ts index 83e2ab2e5..63b4fbc9b 100644 --- a/src/goGenerateTests.ts +++ b/src/goGenerateTests.ts @@ -58,7 +58,7 @@ export function toggleTestFile(): void { for (let doc of vscode.window.visibleTextEditors) { if (doc.document.fileName === targetFilePath) { vscode.commands.executeCommand('vscode.open', vscode.Uri.file(targetFilePath), doc.viewColumn); - return + return; } } vscode.commands.executeCommand('vscode.open', vscode.Uri.file(targetFilePath));