MCPcopy Create free account
hub / github.com/codeaashu/claude-code / runTypeahead

Function runTypeahead

src/components/mcp/ElicitationDialog.tsx:459–466  ·  view source on GitHub ↗

* Append a keystroke to the typeahead buffer (reset after 2s idle) and * call `onMatch` with the index of the first label that prefix-matches. * Shared by boolean y/n, enum accordion, and multi-select accordion.

(char: string, labels: string[], onMatch: (index: number) => void)

Source from the content-addressed store, hash-verified

457 * Shared by boolean y/n, enum accordion, and multi-select accordion.
458 */
459 function runTypeahead(char: string, labels: string[], onMatch: (index: number) => void) {
460 const ta_0 = enumTypeaheadRef.current;
461 if (ta_0.timer !== undefined) clearTimeout(ta_0.timer);
462 ta_0.buffer += char.toLowerCase();
463 ta_0.timer = setTimeout(resetTypeahead, 2000, ta_0);
464 const match = labels.findIndex(l => l.startsWith(ta_0.buffer));
465 if (match !== -1) onMatch(match);
466 }
467
468 // Esc while a field is focused: cancel the dialog.
469 // Uses Settings context (escape-only, no 'n' key) since Dialog's

Callers 1

ElicitationFormDialogFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected