MCPcopy Create free account
hub / github.com/continuedev/continue / parseShortcut

Function parseShortcut

gui/src/components/gui/Shortcut.tsx:33–55  ·  view source on GitHub ↗
(shortcut: string, platform: string)

Source from the content-addressed store, hash-verified

31});
32
33const parseShortcut = (shortcut: string, platform: string) => {
34 if (!shortcut || typeof shortcut !== "string") {
35 console.warn("Invalid shortcut provided:", shortcut);
36 return [];
37 }
38
39 const specialKeyMap = getSpecialKeyMap(platform);
40 return shortcut
41 .split(",")
42 .map((combo) =>
43 combo
44 .trim()
45 .split(" ")
46 .filter((key) => key)
47 .map((key) => {
48 const lowerKey = key.toLowerCase();
49 if (metaKeys.includes(lowerKey)) return getMetaKeyLabel();
50 if (altKeys.includes(lowerKey)) return getAltKeyLabel();
51 return specialKeyMap[lowerKey] || capitalizeKey(key);
52 }),
53 )
54 .filter((combo) => combo.length > 0);
55};
56
57const capitalizeKey = (key: string) =>
58 key.charAt(0).toUpperCase() + key.slice(1).toLowerCase();

Callers 1

ShortcutFunction · 0.85

Calls 5

getMetaKeyLabelFunction · 0.90
getAltKeyLabelFunction · 0.90
getSpecialKeyMapFunction · 0.85
capitalizeKeyFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected