()
| 1501 | } |
| 1502 | |
| 1503 | function rebuildKeymap() { |
| 1504 | const bindings = []; |
| 1505 | cachedResolvedKeyBindings = buildResolvedKeyBindingsSnapshot(); |
| 1506 | commandMap.forEach((command, name) => { |
| 1507 | const bindingInfo = resolveBindingInfo(name); |
| 1508 | command.description = |
| 1509 | bindingInfo?.description || command.defaultDescription; |
| 1510 | const keySource = |
| 1511 | bindingInfo && Object.prototype.hasOwnProperty.call(bindingInfo, "key") |
| 1512 | ? bindingInfo.key |
| 1513 | : (command.defaultKey ?? null); |
| 1514 | command.key = keySource; |
| 1515 | const combos = parseKeyString(keySource); |
| 1516 | combos.forEach((combo) => { |
| 1517 | const cmKey = toCodeMirrorKey(combo); |
| 1518 | if (!cmKey) return; |
| 1519 | bindings.push({ |
| 1520 | key: cmKey, |
| 1521 | run: (view) => executeCommand(name, view), |
| 1522 | preventDefault: true, |
| 1523 | }); |
| 1524 | }); |
| 1525 | }); |
| 1526 | cachedKeymap = bindings; |
| 1527 | resolvedKeyBindingsVersion += 1; |
| 1528 | return bindings; |
| 1529 | } |
| 1530 | |
| 1531 | function resolveCommand(name) { |
| 1532 | return commandMap.get(name) || null; |
no test coverage detected