Skip to content

Commit 2a6caeb

Browse files
committed
Fix command menu recommendation bug
1 parent 0bee37e commit 2a6caeb

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

src/util/ideaBridge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ class IdeaBridge {
446446
name: item.name,
447447
pattern: item.name,
448448
description: item.description,
449-
recommend: item.recommend,
449+
recommend: item.recommend ?? -1,
450450
}));
451451
this.executeHandlers("regCommandList", {
452452
result,

src/views/pages/ChatPanel.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,13 @@ const chatPanel = observer(() => {
8181
messageUtil.registerHandler(
8282
"regCommandList",
8383
(message: { result: Item[] }) => {
84-
input.fetchCommandMenus(message.result);
84+
console.log("regCommandList message: ", message);
85+
const commandMenus = message.result?.map((item) => ({
86+
...item,
87+
recommend: item.args ?? -1,
88+
}));
89+
console.log("regCommandList commandMenus: ", commandMenus);
90+
input.fetchCommandMenus(commandMenus);
8591
if (!isFirstRender.current) {
8692
return;
8793
}

src/views/stores/ChatStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export const ChatStore = types
128128
if (item.name === "help") {
129129
return "";
130130
}
131-
return `<a class="workflow_command" href="${item.pattern}">/${item.name}: ${item.description}</a>`;
131+
return `<a class="workflow_command" href="${item.pattern}">/${item.name}: <span style="color:var(--vscode-editor-foreground)"> ${item.description} </span></a>`;
132132
})
133133
.join("\n\n");
134134
};

src/views/stores/InputStore.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface Item {
77
pattern: string;
88
description: string;
99
recommend: number;
10+
args?: number;
1011
}
1112

1213
const regContextMenus = async () => {

0 commit comments

Comments
 (0)