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';
15
15
import { getBenchmarkFunctions , getTestFunctions } from './testUtils' ;
16
16
import { GoExtensionContext } from './context' ;
17
17
import { GO_MODE } from './goMode' ;
18
+ import { experiments } from './experimental' ;
18
19
19
20
export class GoRunTestCodeLensProvider extends GoBaseCodeLensProvider {
20
21
static activate ( ctx : vscode . ExtensionContext , goCtx : GoExtensionContext ) {
21
22
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
+
22
32
ctx . subscriptions . push ( vscode . languages . registerCodeLensProvider ( GO_MODE , testCodeLensProvider ) ) ;
33
+ ctx . subscriptions . push ( experiments . onDidChange ( ( ) => setEnabled ( ) ) ) ;
23
34
ctx . subscriptions . push (
24
35
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 ( ) ;
31
38
}
32
39
} )
33
40
) ;
You can’t perform that action at this time.
0 commit comments