From b8a0e420f8e8c3abb8ceceecb3e511236e2e9735 Mon Sep 17 00:00:00 2001 From: Rahul A Mistry <149420892+ProdigyRahul@users.noreply.github.com> Date: Wed, 21 Jan 2026 22:05:15 +0530 Subject: feat(app): search on settings shortcuts (#9850) --- packages/app/src/components/settings-keybinds.tsx | 90 +++++++++++++++++++++-- 1 file changed, 83 insertions(+), 7 deletions(-) (limited to 'packages/app/src/components') diff --git a/packages/app/src/components/settings-keybinds.tsx b/packages/app/src/components/settings-keybinds.tsx index 13a0042ff..3f1f34e5f 100644 --- a/packages/app/src/components/settings-keybinds.tsx +++ b/packages/app/src/components/settings-keybinds.tsx @@ -1,6 +1,10 @@ import { Component, For, Show, createMemo, createSignal, onCleanup, onMount } from "solid-js" import { Button } from "@opencode-ai/ui/button" +import { Icon } from "@opencode-ai/ui/icon" +import { IconButton } from "@opencode-ai/ui/icon-button" +import { TextField } from "@opencode-ai/ui/text-field" import { showToast } from "@opencode-ai/ui/toast" +import fuzzysort from "fuzzysort" import { formatKeybind, parseKeybind, useCommand } from "@/context/command" import { useLanguage } from "@/context/language" import { useSettings } from "@/context/settings" @@ -108,6 +112,7 @@ export const SettingsKeybinds: Component = () => { const settings = useSettings() const [active, setActive] = createSignal(null) + const [filter, setFilter] = createSignal("") const stop = () => { if (!active()) return @@ -197,6 +202,45 @@ export const SettingsKeybinds: Component = () => { return out }) + const filtered = createMemo(() => { + const query = filter().toLowerCase().trim() + if (!query) return grouped() + + const map = list() + const out = new Map() + + for (const group of GROUPS) out.set(group, []) + + const items = Array.from(map.entries()).map(([id, meta]) => ({ + id, + title: meta.title, + group: meta.group, + keybind: command.keybind(id) || "", + })) + + const results = fuzzysort.go(query, items, { + keys: ["title", "keybind"], + threshold: -10000, + }) + + for (const result of results) { + const item = result.obj + const ids = out.get(item.group) + if (!ids) continue + ids.push(item.id) + } + + return out + }) + + const hasResults = createMemo(() => { + for (const group of GROUPS) { + const ids = filtered().get(group) ?? [] + if (ids.length > 0) return true + } + return false + }) + const used = createMemo(() => { const map = new Map() @@ -313,22 +357,43 @@ export const SettingsKeybinds: Component = () => { "linear-gradient(to bottom, var(--surface-raised-stronger-non-alpha) calc(100% - 24px), transparent)", }} > -
-

{language.t("settings.shortcuts.title")}

- +
+
+

{language.t("settings.shortcuts.title")}

+ +
+ +
+ + + + setFilter("")} /> + +
{(group) => ( - 0}> + 0}>

{language.t(groupKey[group])}

- + {(id) => (
{title(id)} @@ -357,6 +422,17 @@ export const SettingsKeybinds: Component = () => { )} + + +
+ + {language.t("settings.shortcuts.search.empty")} + + + "{filter()}" + +
+
) -- cgit v1.2.3