Skip to content

Commit 249d05f

Browse files
author
Kapil Borle
committed
Send filepath param for SetPSSARulesRequest
1 parent e98b1e8 commit 249d05f

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/features/SelectPSSARules.ts

+13-7
Original file line numberDiff line numberDiff line change
@@ -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+
2328
export 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

Comments
 (0)