Skip to content

Commit 20812b7

Browse files
firelizzard18suzmue
authored andcommitted
all: add setting to disable test explorer
Change-Id: Iabbca677d2d86d48ddfec52ce4216bd0b57b1527 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/350157 Reviewed-by: Hyang-Ah Hana Kim <[email protected]> Trust: Hyang-Ah Hana Kim <[email protected]> Trust: Suzy Mueller <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
1 parent 8b3398f commit 20812b7

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

docs/settings.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,11 @@ Default: `false`
402402

403403
Concatenate all test log messages for a given location into a single message.
404404

405+
Default: `true`
406+
### `go.testExplorer.enable`
407+
408+
Enable the Go test explorer
409+
405410
Default: `true`
406411
### `go.testExplorer.packageDisplayMode`
407412

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,12 @@
13021302
"description": "Flags to pass to `go test`. If null, then buildFlags will be used. This is not propagated to the language server.",
13031303
"scope": "resource"
13041304
},
1305+
"go.testExplorer.enable": {
1306+
"type": "boolean",
1307+
"default": true,
1308+
"scope": "window",
1309+
"description": "Enable the Go test explorer"
1310+
},
13051311
"go.testExplorer.packageDisplayMode": {
13061312
"type": "string",
13071313
"enum": [

src/goMain.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ If you would like additional configuration for diagnostics from gopls, please se
336336
})
337337
);
338338

339-
if (isVscodeTestingAPIAvailable) {
339+
if (isVscodeTestingAPIAvailable && cfg.get<boolean>('testExplorer.enable')) {
340340
GoTestExplorer.setup(ctx);
341341
}
342342

@@ -531,6 +531,15 @@ If you would like additional configuration for diagnostics from gopls, please se
531531
// TODO: actively maintain our own disposables instead of keeping pushing to ctx.subscription.
532532
}
533533
}
534+
if (e.affectsConfiguration('go.testExplorer.enable')) {
535+
const msg =
536+
'Go test explorer has been enabled or disabled. For this change to take effect, the window must be reloaded.';
537+
vscode.window.showInformationMessage(msg, 'Reload').then((selected) => {
538+
if (selected === 'Reload') {
539+
vscode.commands.executeCommand('workbench.action.reloadWindow');
540+
}
541+
});
542+
}
534543
})
535544
);
536545

0 commit comments

Comments
 (0)