summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/components/settings-keybinds.tsx
diff options
context:
space:
mode:
authorAdam <[email protected]>2026-01-20 07:10:40 -0600
committerAdam <[email protected]>2026-01-20 07:33:44 -0600
commit340285575b510f4ab466fa80d0de1cf20b4e048a (patch)
tree9587a21664547875d060258ad7ee7b3de0dba290 /packages/app/src/components/settings-keybinds.tsx
parentdd5b5f5482df86959f0ea90e20f86ca7a5e19b08 (diff)
downloadopencode-340285575b510f4ab466fa80d0de1cf20b4e048a.tar.gz
opencode-340285575b510f4ab466fa80d0de1cf20b4e048a.zip
chore: cleanup
Diffstat (limited to 'packages/app/src/components/settings-keybinds.tsx')
-rw-r--r--packages/app/src/components/settings-keybinds.tsx38
1 files changed, 29 insertions, 9 deletions
diff --git a/packages/app/src/components/settings-keybinds.tsx b/packages/app/src/components/settings-keybinds.tsx
index 811b34f9b..7bc9b1fd7 100644
--- a/packages/app/src/components/settings-keybinds.tsx
+++ b/packages/app/src/components/settings-keybinds.tsx
@@ -124,13 +124,23 @@ export const SettingsKeybinds: Component = () => {
const out = new Map<string, KeybindMeta>()
out.set(PALETTE_ID, { title: "Command palette", group: "General" })
+ for (const opt of command.catalog) {
+ if (opt.id.startsWith("suggested.")) continue
+ out.set(opt.id, { title: opt.title, group: groupFor(opt.id) })
+ }
+
for (const opt of command.options) {
if (opt.id.startsWith("suggested.")) continue
+ out.set(opt.id, { title: opt.title, group: groupFor(opt.id) })
+ }
- out.set(opt.id, {
- title: opt.title,
- group: groupFor(opt.id),
- })
+ const keybinds = settings.current.keybinds as Record<string, string | undefined> | undefined
+ if (keybinds) {
+ for (const [id, value] of Object.entries(keybinds)) {
+ if (typeof value !== "string") continue
+ if (out.has(id)) continue
+ out.set(id, { title: id, group: groupFor(id) })
+ }
}
return out
@@ -181,11 +191,21 @@ export const SettingsKeybinds: Component = () => {
add(sig, { id: PALETTE_ID, title: "Command palette" })
}
- for (const opt of command.options) {
- if (opt.id.startsWith("suggested.")) continue
- if (!opt.keybind) continue
- for (const sig of signatures(opt.keybind)) {
- add(sig, { id: opt.id, title: opt.title })
+ const valueFor = (id: string) => {
+ const custom = settings.keybinds.get(id)
+ if (typeof custom === "string") return custom
+
+ const live = command.options.find((x) => x.id === id)
+ if (live?.keybind) return live.keybind
+
+ const meta = command.catalog.find((x) => x.id === id)
+ return meta?.keybind
+ }
+
+ for (const id of list().keys()) {
+ if (id === PALETTE_ID) continue
+ for (const sig of signatures(valueFor(id))) {
+ add(sig, { id, title: title(id) })
}
}