Skip to content

Commit 76d999d

Browse files
New command to open Copilot Chat (AST-0000) (#1272)
* try to run a new command * fix --------- Co-authored-by: Ben Alvo <144705560+cx-ben-alvo@users.noreply.github.com>
1 parent a196f99 commit 76d999d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/commands/openAIChatCommand.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,14 @@ export class CopilotChatCommand {
216216
return;
217217
}
218218
await vscode.commands.executeCommand(constants.copilotNewChatOpen);
219-
await vscode.commands.executeCommand(constants.copilotChatOpenWithQueryCommand, { query: `${question}` });
219+
try {
220+
await vscode.commands.executeCommand(constants.newCopilotChatOpenWithQueryCommand, { query: `${question}` });
221+
} catch (error) {
222+
if (error.message.includes(`command '${constants.newCopilotChatOpenWithQueryCommand}' not found`)) {
223+
await vscode.commands.executeCommand(constants.copilotChatOpenWithQueryCommand, { query: `${question}` });
224+
}
225+
226+
}
220227
}
221228

222229
private logUserEvent(EventType: string, subType: string, item: HoverData | SecretsHoverData | AscaHoverData | ContainersHoverData | IacHoverData): void {

src/utils/common/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ export const constants = {
274274
copilotChatExtensionId: "GitHub.copilot-chat",
275275
copilotNewChatOpen: "workbench.action.chat.newChat",
276276
copilotChatOpenWithQueryCommand: "workbench.action.chat.openAgent",
277+
newCopilotChatOpenWithQueryCommand: "workbench.action.chat.openagent",
277278

278279
openAIChat: "fixWithAIChat",
279280
viewDetails: "viewDetails",

0 commit comments

Comments
 (0)