MCPcopy Create free account
hub / github.com/anomalyco/opencode / listFor

Function listFor

packages/app/src/components/settings-keybinds.tsx:132–155  ·  view source on GitHub ↗
(command: CommandContext, map: KeybindMap, palette: string)

Source from the content-addressed store, hash-verified

130}
131
132function listFor(command: CommandContext, map: KeybindMap, palette: string) {
133 const out = new Map<string, KeybindMeta>()
134 out.set(PALETTE_ID, { title: palette, group: "General" })
135
136 for (const opt of command.catalog) {
137 if (opt.id.startsWith("suggested.")) continue
138 if (opt.hidden) continue
139 out.set(opt.id, { title: opt.title, group: groupFor(opt.id) })
140 }
141
142 for (const opt of command.options) {
143 if (opt.id.startsWith("suggested.")) continue
144 if (opt.hidden) continue
145 out.set(opt.id, { title: opt.title, group: groupFor(opt.id) })
146 }
147
148 for (const [id, value] of Object.entries(map)) {
149 if (typeof value !== "string") continue
150 if (out.has(id)) continue
151 out.set(id, { title: id, group: groupFor(id) })
152 }
153
154 return out
155}
156
157function groupedFor(list: Map<string, KeybindMeta>) {
158 const out = new Map<KeybindGroup, string[]>()

Callers 1

SettingsKeybindsFunction · 0.85

Calls 2

groupForFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected