File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -15,19 +15,26 @@ import { GoDocumentSymbolProvider } from './goDocumentSymbols';
1515import { getBenchmarkFunctions , getTestFunctions } from './testUtils' ;
1616import { GoExtensionContext } from './context' ;
1717import { GO_MODE } from './goMode' ;
18+ import { experiments } from './experimental' ;
1819
1920export class GoRunTestCodeLensProvider extends GoBaseCodeLensProvider {
2021 static activate ( ctx : vscode . ExtensionContext , goCtx : GoExtensionContext ) {
2122 const testCodeLensProvider = new this ( goCtx ) ;
23+ const setEnabled = ( ) => {
24+ const updatedGoConfig = getGoConfig ( ) ;
25+ if ( updatedGoConfig [ 'enableCodeLens' ] ) {
26+ testCodeLensProvider . setEnabled (
27+ updatedGoConfig [ 'enableCodeLens' ] [ 'runtest' ] && ! experiments . testExplorer
28+ ) ;
29+ }
30+ } ;
31+
2232 ctx . subscriptions . push ( vscode . languages . registerCodeLensProvider ( GO_MODE , testCodeLensProvider ) ) ;
33+ ctx . subscriptions . push ( experiments . onDidChange ( ( ) => setEnabled ( ) ) ) ;
2334 ctx . subscriptions . push (
2435 vscode . workspace . onDidChangeConfiguration ( async ( e : vscode . ConfigurationChangeEvent ) => {
25- if ( ! e . affectsConfiguration ( 'go' ) ) {
26- return ;
27- }
28- const updatedGoConfig = getGoConfig ( ) ;
29- if ( updatedGoConfig [ 'enableCodeLens' ] ) {
30- testCodeLensProvider . setEnabled ( updatedGoConfig [ 'enableCodeLens' ] [ 'runtest' ] ) ;
36+ if ( e . affectsConfiguration ( 'go' ) ) {
37+ setEnabled ( ) ;
3138 }
3239 } )
3340 ) ;
You can’t perform that action at this time.
0 commit comments