Skip to content

Commit 1d25455

Browse files
committed
Fix configuration quick pick selection logic to correctly handle separators and explicit IDs
- is that true none configuration can be highlighted in a fresh workspace? Should be the first one then. └── apps └── editor └── src ├── commands │ ├── code-at-cursor-command │ │ └── utils │ │ ├── get-code-at-cursor-config.ts │ │ └── perform-code-at-cursor.ts │ └── generate-commit-message-commands │ ├── actions │ │ └── run-generate-action.ts │ └── utils │ └── get-commit-message-config.ts ├── features │ └── search-files │ ├── search-modes │ │ └── perform-intelligent-search-mode.ts │ └── utils │ └── prompt-for-config.ts ├── utils │ └── show-configuration-quick-pick.ts └── views └── prompt └── backend └── message-handlers ├── handle-autofill.ts ├── handle-make-api-call.ts ├── handle-voice-input.ts └── utils └── intelligent-update-utils.ts
1 parent df047bb commit 1d25455

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

‎apps/editor/src/utils/show-configuration-quick-pick.ts‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,14 @@ export const show_configuration_quick_pick = async <T>(
112112
quick_pick.buttons = [close_button]
113113
}
114114

115-
const last_selected_item = items_with_duplicates.find(
116-
(item) => item.id === last_selected_id
117-
)
115+
const last_selected_item =
116+
last_selected_id !== undefined
117+
? items_with_duplicates.find(
118+
(item) =>
119+
item.kind !== vscode.QuickPickItemKind.Separator &&
120+
item.id === last_selected_id
121+
)
122+
: undefined
118123
if (last_selected_item) {
119124
quick_pick.activeItems = [last_selected_item]
120125
} else if (items_with_duplicates.length > 0) {
@@ -155,7 +160,7 @@ export const show_configuration_quick_pick = async <T>(
155160

156161
quick_pick.onDidAccept(() => {
157162
const selected = quick_pick.selectedItems[0]
158-
if (selected && selected.original_item && selected.id) {
163+
if (selected && selected.original_item && selected.id !== undefined) {
159164
resolved = true
160165
resolve({
161166
item: selected.original_item,

0 commit comments

Comments
 (0)