fix: make SPACE key toggle selections in autocomplete multiselect prompts (#1557)

- Override _isActionKey to treat SPACE as an action key instead of search input,
and add key handler to toggle selections when not navigating
- update IDE selection prompt message from "Select tools:" to "Integrate with:".
This commit is contained in:
Davor Racic 2026-02-06 14:27:51 +01:00 committed by GitHub
parent 8be3713595
commit 7c0e5d5e1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 1 deletions

View File

@ -322,6 +322,25 @@ async function autocompleteMultiselect(options) {
},
});
// === FIX: Make SPACE always act as selection key (not search input) ===
// Override _isActionKey to treat SPACE like TAB - always an action key
// This prevents SPACE from being added to the search input
const originalIsActionKey = prompt._isActionKey.bind(prompt);
prompt._isActionKey = function (char, key) {
if (key && key.name === 'space') {
return true;
}
return originalIsActionKey(char, key);
};
// Handle SPACE toggle when NOT navigating (internal code only handles it when isNavigating=true)
prompt.on('key', (char, key) => {
if (key && key.name === 'space' && !prompt.isNavigating && prompt.focusedValue !== undefined) {
prompt.toggleSelected(prompt.focusedValue);
}
});
// === END FIX ===
const result = await prompt.prompt();
await handleCancel(result);
return result;

View File

@ -634,7 +634,7 @@ class UI {
// Interactive mode
const interactiveSelectedIdes = await prompts.autocompleteMultiselect({
message: 'Select tools:',
message: 'Integrate with:',
options: allToolOptions,
initialValues: configuredIdes.length > 0 ? configuredIdes : undefined,
required: false,