@@ -15,11 +15,16 @@ export namespace SetPSSARulesRequest {
1515 export const type : RequestType < any , any , void > = { get method ( ) : string { return "powerShell/setPSSARules" ; } } ;
1616}
1717
18- interface IRuleInfo {
18+ class RuleInfo {
1919 name : string ;
2020 isEnabled : boolean ;
2121}
2222
23+ class SetPSSARulesRequestParams {
24+ filepath : string ;
25+ ruleInfos : RuleInfo [ ] ;
26+ }
27+
2328export class SelectPSSARulesFeature implements IFeature {
2429
2530 private command : vscode . Disposable ;
@@ -28,7 +33,6 @@ export class SelectPSSARulesFeature implements IFeature {
2833 constructor ( ) {
2934 this . command = vscode . commands . registerCommand ( "PowerShell.SelectPSSARules" , ( ) => {
3035 if ( this . languageClient === undefined ) {
31- // TODO: Log error message
3236 return ;
3337 }
3438
@@ -38,15 +42,17 @@ export class SelectPSSARulesFeature implements IFeature {
3842 "PowerShell extension uses PSScriptAnalyzer settings file - Cannot update rules." ) ;
3943 return ;
4044 }
41- let options : CheckboxQuickPickItem [ ] = returnedRules . map ( function ( rule : IRuleInfo ) : CheckboxQuickPickItem {
45+ let options : CheckboxQuickPickItem [ ] = returnedRules . map ( function ( rule : RuleInfo ) : CheckboxQuickPickItem {
4246 return { name : rule . name , isSelected : rule . isEnabled } ;
4347 } ) ;
4448 CheckboxQuickPick . show ( options , ( updatedOptions ) => {
45- this . languageClient . sendRequest (
46- SetPSSARulesRequest . type ,
47- updatedOptions . map ( function ( option : CheckboxQuickPickItem ) : IRuleInfo {
49+ let filepath : string = vscode . window . activeTextEditor . document . uri . fsPath ;
50+ let ruleInfos : RuleInfo [ ] = updatedOptions . map (
51+ function ( option : CheckboxQuickPickItem ) : RuleInfo {
4852 return { name : option . name , isEnabled : option . isSelected } ;
49- } ) ) ;
53+ } ) ;
54+ let requestParams : SetPSSARulesRequestParams = { filepath, ruleInfos} ;
55+ this . languageClient . sendRequest ( SetPSSARulesRequest . type , requestParams ) ;
5056 } ) ;
5157 } ) ;
5258 } ) ;
0 commit comments