(command: CommandContext, map: KeybindMap, palette: string)
| 130 | } |
| 131 | |
| 132 | function 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 | |
| 157 | function groupedFor(list: Map<string, KeybindMeta>) { |
| 158 | const out = new Map<KeybindGroup, string[]>() |
no test coverage detected