History

refactor(web): remove unused model picker hint helpers (#10072)

Julius Marminge committed 2 months ago

Commit ab0933a1 parent b92a8122 files · +0 −42Browse files

Unified · Split

2 files
  1. apps/web/src/keybindings.test.ts +0 −16
  2. apps/web/src/keybindings.ts +0 −26
apps/web/src/keybindings.test.ts+0−16
@@ -19,7 +19,6 @@ import { · 18 unmodified lines
1919 isTerminalSplitVerticalShortcut,
2020 isTerminalToggleShortcut,
2121 resolveShortcutCommand,
22− shouldShowModelPickerJumpHints,
2322 shouldShowThreadJumpHintsForModifiers,
2423 shortcutLabelForCommand,
2524 terminalDeleteShortcutData,
@@ -541,21 +540,6 @@ describe("model picker navigation helpers", () => { · 515 unmodified lines
541540 assert.strictEqual(modelPickerJumpIndexFromCommand("modelPicker.jump.3"), 2);
542541 assert.isNull(modelPickerJumpIndexFromCommand("thread.jump.1"));
543542 });
544−
545− it("shows jump hints only while the model picker context is active", () => {
546− assert.isFalse(
547− shouldShowModelPickerJumpHints(event({ metaKey: true }), DEFAULT_BINDINGS, {
548− platform: "MacIntel",
549− context: { modelPickerOpen: false },
550− }),
551− );
552− assert.isTrue(
553− shouldShowModelPickerJumpHints(event({ metaKey: true }), DEFAULT_BINDINGS, {
554− platform: "MacIntel",
555− context: { modelPickerOpen: true },
556− }),
557− );
558− });
559543 });
560544
561545 describe("chat/editor shortcuts", () => {
apps/web/src/keybindings.ts+0−26
@@ -329,32 +329,6 @@ export function modelPickerJumpIndexFromCommand(command: string): number | null · 328 unmodified lines
329329 return index === -1 ? null : index;
330330 }
331331
332−export function shouldShowModelPickerJumpHints(
333− event: ShortcutEventLike,
334− keybindings: ResolvedKeybindingsConfig,
335− options?: ShortcutMatchOptions,
336−): boolean {
337− return shouldShowModelPickerJumpHintsForModifiers(event, keybindings, options);
338−}
339−
340−export function shouldShowModelPickerJumpHintsForModifiers(
341− modifiers: ShortcutModifierStateLike,
342− keybindings: ResolvedKeybindingsConfig,
343− options?: ShortcutMatchOptions,
344−): boolean {
345− const platform = resolvePlatform(options);
346−
347− for (const command of MODEL_PICKER_JUMP_KEYBINDING_COMMANDS) {
348− const shortcut = findEffectiveShortcutForCommand(keybindings, command, options);
349− if (!shortcut) continue;
350− if (matchesShortcutModifiers(modifiers, shortcut, platform)) {
351− return true;
352− }
353− }
354−
355− return false;
356−}
357−
358332 export function isTerminalToggleShortcut(
359333 event: ShortcutEventLike,
360334 keybindings: ResolvedKeybindingsConfig,