@@ -11,32 +11,32 @@ import AbstractProvider from './abstractProvider';
1111import * as protocol from '../omnisharp/protocol' ;
1212import { toRange2 } from '../omnisharp/typeConvertion' ;
1313import * as serverUtils from '../omnisharp/utils' ;
14+ import { Options } from '../omnisharp/options' ;
1415import TelemetryReporter from 'vscode-extension-telemetry' ;
1516
1617export default class CodeActionProvider extends AbstractProvider implements vscode . CodeActionProvider {
1718
18- private _disabled : boolean ;
19+ private _options : Options ;
1920 private _commandId : string ;
2021
2122 constructor ( server : OmniSharpServer , reporter : TelemetryReporter ) {
2223 super ( server , reporter ) ;
2324
2425 this . _commandId = 'omnisharp.runCodeAction' ;
2526
26- this . _checkOption ( ) ;
27+ this . _resetCachedOptions ( ) ;
2728
28- let d1 = vscode . workspace . onDidChangeConfiguration ( this . _checkOption , this ) ;
29+ let d1 = vscode . workspace . onDidChangeConfiguration ( this . _resetCachedOptions , this ) ;
2930 let d2 = vscode . commands . registerCommand ( this . _commandId , this . _runCodeAction , this ) ;
3031 this . addDisposables ( d1 , d2 ) ;
3132 }
3233
33- private _checkOption ( ) : void {
34- let value = vscode . workspace . getConfiguration ( ) . get ( 'csharp.disableCodeActions' , false ) ;
35- this . _disabled = value ;
34+ private _resetCachedOptions ( ) : void {
35+ this . _options = Options . Read ( ) ;
3636 }
3737
3838 public provideCodeActions ( document : vscode . TextDocument , range : vscode . Range , context : vscode . CodeActionContext , token : vscode . CancellationToken ) : Promise < vscode . Command [ ] > {
39- if ( this . _disabled ) {
39+ if ( this . _options . disableCodeActions ) {
4040 return ;
4141 }
4242
0 commit comments