MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / generateHints

Function generateHints

src/palettes/commandPalette/index.js:14–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12 });
13
14 function generateHints() {
15 const registeredCommands = getRegisteredCommands();
16 const hints = [];
17
18 registeredCommands.forEach(({ name, description, key }) => {
19 const keyLabel = key ? key.split("|")[0] : "";
20 const item = (recentlyUsed) => ({
21 value: name,
22 text: `<span ${recentlyUsed ? `data-str='${strings["recently used"]}'` : ""}>${description ?? name}</span><small>${keyLabel}</small>`,
23 });
24 if (recentCommands.commands.includes(name)) {
25 hints.unshift(item(true));
26 return;
27 }
28 hints.push(item(false));
29 });
30
31 return hints;
32 }
33
34 function onselect(value) {
35 const executed = executeCommand(value, editorManager.editor);

Callers

nothing calls this directly

Calls 2

getRegisteredCommandsFunction · 0.90
itemFunction · 0.70

Tested by

no test coverage detected