Skip to content

Commit 70d16be

Browse files
authored
fix: parse commands in chat.open commands (microsoft#263458)
`workbench.action.chat.open` did not always trigger a parse of the input resulting in `/<prompt>` not being recognized as a prompt command. If `isPartialQuery: false` (default), then the commanded used [`acceptInput` intead of `setInput`](https://github.com/microsoft/vscode/blob/709b8fabf55c505cbe5603ce654ecf3a8766a7a6/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts#L244) only the latter of which will trigger a [re-parse of the query](https://github.com/microsoft/vscode/blob/709b8fabf55c505cbe5603ce654ecf3a8766a7a6/src/vs/workbench/contrib/chat/browser/chatWidget.ts#L1640) to critcially turn [`/<prompt>` into a `ChatRequestSlashPromptPart`](https://github.com/microsoft/vscode/blob/d2ff8d16065d4748b8a205bfebdc98d7d76f7864/src/vs/workbench/contrib/chat/common/chatRequestParser.ts#L231). **Reviewers**: There's a few places `acceptInput` is called with a query in the codebase. It's not clear to me if the others have the same issue or if always triggering a re-parse would double parse.
1 parent d3082b4 commit 70d16be

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/vs/workbench/contrib/chat/browser/actions/chatActions.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,15 @@ abstract class OpenChatGlobalAction extends Action2 {
236236
let resp: Promise<IChatResponseModel | undefined> | undefined;
237237

238238
if (opts?.query) {
239-
if (opts.isPartialQuery) {
240-
chatWidget.setInput(opts.query);
241-
} else {
239+
chatWidget.setInput(opts.query);
240+
241+
if (!opts.isPartialQuery) {
242242
await chatWidget.waitForReady();
243243
await waitForDefaultAgent(chatAgentService, chatWidget.input.currentModeKind);
244-
resp = chatWidget.acceptInput(opts.query);
244+
resp = chatWidget.acceptInput();
245245
}
246246
}
247+
247248
if (opts?.toolIds && opts.toolIds.length > 0) {
248249
for (const toolId of opts.toolIds) {
249250
const tool = toolsService.getTool(toolId);

0 commit comments

Comments
 (0)