Skip to content

Commit 5669bf4

Browse files
committed
Simplify SPARK picker state storage
1 parent 2bd3914 commit 5669bf4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

integration/vscode/ada/src/sparkOptionsPicker.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { CancellationError, QuickPickItem } from 'vscode';
22
import { adaExtState } from './extension';
33
import { InputFlowAction, MultiStepInput } from './multiStepInput';
4+
import assert from 'assert';
45

56
interface SPARKOption extends QuickPickItem {
67
cliArgs: string[];
@@ -14,7 +15,9 @@ const proofLevels: SPARKOption[] = [
1415
{ label: '4', description: 'Slowest, most provers' },
1516
].map((v) => ({ ...v, cliArgs: [`--level=${v.label}`] }));
1617

17-
const defaultProofLevel = proofLevels.find((v) => v.description?.includes('default'))!;
18+
const tmpDefaultProofLevel = proofLevels.find((v) => v.description?.includes('default'));
19+
assert(tmpDefaultProofLevel, 'defaultProofLevel should not be null');
20+
const defaultProofLevel: SPARKOption = tmpDefaultProofLevel;
1821

1922
const options: SPARKOption[] = [
2023
{ label: 'Multiprocessing', cliArgs: ['-j0'] },
@@ -76,7 +79,7 @@ const WS_STATE_KEY_PICKER = 'ada.spark.lastPickerState';
7679
*/
7780
export async function askSPARKOptions(): Promise<string[]> {
7881
const title = 'Select GNATprove Options';
79-
async function pickProofLevel(input: MultiStepInput, state: Partial<PickerState>) {
82+
async function pickProofLevel(input: MultiStepInput, state: PickerState) {
8083
const choice: SPARKOption = await input.showQuickPick({
8184
title,
8285
step: 1,
@@ -89,7 +92,7 @@ export async function askSPARKOptions(): Promise<string[]> {
8992
return (input: MultiStepInput) => pickOtherOptions(input, state);
9093
}
9194

92-
async function pickOtherOptions(input: MultiStepInput, state: Partial<PickerState>) {
95+
async function pickOtherOptions(input: MultiStepInput, state: PickerState) {
9396
const choice: SPARKOption[] = await input.showQuickPick({
9497
title,
9598
step: 2,
@@ -137,7 +140,7 @@ function getSavedPickerState() {
137140
return pickerState;
138141
}
139142

140-
function toCLIArgs(choices: Partial<PickerState>): string[] {
143+
function toCLIArgs(choices: PickerState): string[] {
141144
const args: string[] = [];
142145

143146
if (choices.proofLevel) {

0 commit comments

Comments
 (0)