Skip to content

Commit f8822bb

Browse files
authored
Merge pull request #407 from PowerShell/kapilmb/fix-select-pssa-rules
Handle cancelling PSSA rule selection
2 parents 1a1b6e0 + ede7ea2 commit f8822bb

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/features/SelectPSSARules.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ class RuleInfo {
2020
isEnabled: boolean;
2121
}
2222

23-
class SetPSSARulesRequestParams {
24-
filepath: string;
25-
ruleInfos: RuleInfo[];
26-
}
27-
2823
export class SelectPSSARulesFeature implements IFeature {
2924

3025
private command: vscode.Disposable;
@@ -47,15 +42,20 @@ export class SelectPSSARulesFeature implements IFeature {
4742
});
4843

4944
showCheckboxQuickPick(options)
50-
.then(updatedOptions => {
51-
let filepath: string = vscode.window.activeTextEditor.document.uri.fsPath;
52-
let ruleInfos: RuleInfo[] = updatedOptions.map(
53-
function (option: CheckboxQuickPickItem): RuleInfo {
54-
return { name: option.label, isEnabled: option.isSelected };
45+
.then((updatedOptions: CheckboxQuickPickItem[]) => {
46+
if (updatedOptions === undefined) {
47+
return;
48+
}
49+
this.languageClient.sendRequest(
50+
SetPSSARulesRequest.type,
51+
{
52+
filepath: vscode.window.activeTextEditor.document.uri.fsPath,
53+
ruleInfos: updatedOptions.map(
54+
function (option: CheckboxQuickPickItem): RuleInfo {
55+
return { name: option.label, isEnabled: option.isSelected };
56+
})
5557
});
56-
let requestParams: SetPSSARulesRequestParams = {filepath, ruleInfos};
57-
this.languageClient.sendRequest(SetPSSARulesRequest.type, requestParams);
58-
});
58+
});
5959
});
6060
});
6161
}

0 commit comments

Comments
 (0)