Is It possible to submit chat programmatically?

I use the following command to send prompt to chat in a vscode extension.

vscode.commands.executeCommand('workbench.action.chat.open', prompt);

I am wandreing if there is a commad to submit automatically the chat without clicking in the submit button.

Hey, good question. As far as I know, workbench.action.chat.open fills the prompt text, but it doesn’t auto-send it.

A similar request was discussed in this thread, and a clipboard workaround was suggested: A command for passing a prompt to the chat

The idea is to open chat via composer.newAgentChat, write the prompt to the clipboard, then paste it with editor.action.clipboardPasteAction. The full code example is in post #4 of that thread.

For auto-submit after pasting, you can try running composer.startGeneration or workbench.action.chat.submit, but those aren’t official commands, and availability depends on the version. What Cursor version are you on?

Let me know if it worked.