Skip to content

Commit aa3937c

Browse files
authored
Fix filtering and add missing experiments on quick pick experiment selection (#3056)
* Allow filtering by description/detail on quick pick exp selection * Add missing experiments on "Modify Experiment Param(s) and ..." commands
1 parent c550193 commit aa3937c

File tree

6 files changed

+25
-9
lines changed

6 files changed

+25
-9
lines changed

extension/src/experiments/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ export class Experiments extends BaseRepository<TableData> {
593593
}
594594

595595
const experiment = await pickExperiment(
596-
this.experiments.getExperiments(),
596+
this.experiments.getAllExperiments(),
597597
Title.SELECT_BASE_EXPERIMENT
598598
)
599599

extension/src/experiments/model/quickPick.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ describe('pickExperiments', () => {
7070
}
7171
],
7272
MAX_SELECTED_EXPERIMENTS,
73-
Title.SELECT_EXPERIMENTS
73+
Title.SELECT_EXPERIMENTS,
74+
{ matchOnDescription: true, matchOnDetail: true }
7475
)
7576
})
7677

@@ -162,7 +163,8 @@ describe('pickExperiments', () => {
162163
],
163164
[],
164165
MAX_SELECTED_EXPERIMENTS,
165-
Title.SELECT_EXPERIMENTS
166+
Title.SELECT_EXPERIMENTS,
167+
{ matchOnDescription: true, matchOnDetail: true }
166168
)
167169
})
168170

@@ -250,7 +252,8 @@ describe('pickExperiments', () => {
250252
],
251253
[getExpectedItem(selectedCheckpoint)],
252254
MAX_SELECTED_EXPERIMENTS,
253-
Title.SELECT_EXPERIMENTS
255+
Title.SELECT_EXPERIMENTS,
256+
{ matchOnDescription: true, matchOnDetail: true }
254257
)
255258
})
256259
})

extension/src/experiments/model/quickPicks.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export const pickExperiments = (
135135
items,
136136
selectedItems,
137137
MAX_SELECTED_EXPERIMENTS,
138-
Title.SELECT_EXPERIMENTS
138+
Title.SELECT_EXPERIMENTS,
139+
{ matchOnDescription: true, matchOnDetail: true }
139140
)
140141
}

extension/src/experiments/quickPick.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const pickExperiment = (
2121
label,
2222
value: { id, name: name || label }
2323
})),
24-
{ title }
24+
{ matchOnDescription: true, matchOnDetail: true, title }
2525
)
2626
}
2727
}

extension/src/test/suite/experiments/workspace.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,8 @@ suite('Workspace Experiments Test Suite', () => {
530530
],
531531
{
532532
canPickMany: false,
533+
matchOnDescription: true,
534+
matchOnDetail: true,
533535
title: Title.SELECT_EXPERIMENT
534536
}
535537
)

extension/src/vscode/quickPick.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,21 @@ export const quickPickOne = (
4545
const createQuickPick = <T>(
4646
items: readonly QuickPickItemWithValue<T>[],
4747
selectedItems: readonly QuickPickItemWithValue<T>[] | undefined,
48-
options: { canSelectMany: boolean; placeholder?: string; title: Title }
48+
options: {
49+
canSelectMany: boolean
50+
placeholder?: string
51+
title: Title
52+
matchOnDescription?: boolean
53+
matchOnDetail?: boolean
54+
}
4955
): QuickPick<QuickPickItemWithValue<T>> => {
5056
const quickPick = window.createQuickPick<QuickPickItemWithValue<T>>()
5157

5258
quickPick.canSelectMany = options.canSelectMany
5359
quickPick.placeholder = options.placeholder
5460
quickPick.title = options.title
61+
quickPick.matchOnDescription = options.matchOnDescription || false
62+
quickPick.matchOnDetail = options.matchOnDetail || false
5563

5664
quickPick.items = items
5765
if (selectedItems) {
@@ -181,12 +189,14 @@ export const quickPickLimitedValues = <T>(
181189
items: QuickPickItemWithValue<T>[],
182190
selectedItems: readonly QuickPickItemWithValue<T>[],
183191
maxSelectedItems: number,
184-
title: Title
192+
title: Title,
193+
options?: { matchOnDescription?: boolean; matchOnDetail?: boolean }
185194
): Promise<Exclude<T, undefined>[] | undefined> =>
186195
new Promise(resolve => {
187196
const quickPick = createQuickPick(items, selectedItems, {
188197
canSelectMany: true,
189-
title
198+
title,
199+
...options
190200
})
191201

192202
limitSelected<T>(quickPick, maxSelectedItems)

0 commit comments

Comments
 (0)