@@ -28,12 +28,21 @@ class OmniSharpCodeLens extends vscode.CodeLens {
2828export default class OmniSharpCodeLensProvider extends AbstractProvider implements vscode . CodeLensProvider {
2929
3030 private _testManager : TestManager ;
31+ private _options : Options ;
3132
3233 constructor ( server : OmniSharpServer , reporter : TelemetryReporter , testManager : TestManager )
3334 {
3435 super ( server , reporter ) ;
3536
3637 this . _testManager = testManager ;
38+ this . _checkOptions ( ) ;
39+
40+ let configChangedDisposable = vscode . workspace . onDidChangeConfiguration ( this . _checkOptions , this ) ;
41+ this . addDisposables ( configChangedDisposable ) ;
42+ }
43+
44+ private _checkOptions ( ) : void {
45+ this . _options = Options . Read ( ) ;
3746 }
3847
3948 private static filteredSymbolNames : { [ name : string ] : boolean } = {
@@ -44,8 +53,7 @@ export default class OmniSharpCodeLensProvider extends AbstractProvider implemen
4453 } ;
4554
4655 provideCodeLenses ( document : vscode . TextDocument , token : vscode . CancellationToken ) : vscode . CodeLens [ ] | Thenable < vscode . CodeLens [ ] > {
47- const options = Options . Read ( ) ;
48- if ( ! options . showReferencesCodeLens )
56+ if ( ! this . _options . showReferencesCodeLens && ! this . _options . showTestsCodeLens )
4957 {
5058 return [ ] ;
5159 }
@@ -64,13 +72,17 @@ export default class OmniSharpCodeLensProvider extends AbstractProvider implemen
6472 }
6573
6674 let lens = new OmniSharpCodeLens ( fileName , toRange ( node . Location ) ) ;
67- bucket . push ( lens ) ;
75+ if ( this . _options . showReferencesCodeLens ) {
76+ bucket . push ( lens ) ;
77+ }
6878
6979 for ( let child of node . ChildNodes ) {
7080 this . _convertQuickFix ( bucket , fileName , child ) ;
7181 }
7282
73- this . _updateCodeLensForTest ( bucket , fileName , node ) ;
83+ if ( this . _options . showTestsCodeLens ) {
84+ this . _updateCodeLensForTest ( bucket , fileName , node ) ;
85+ }
7486 }
7587
7688 resolveCodeLens ( codeLens : vscode . CodeLens , token : vscode . CancellationToken ) : Thenable < vscode . CodeLens > {
0 commit comments