Adding text to chat from extension

I’m creating a VSCode extension that helps bring bugs reported into the editor to give cursor chat as much context as possible when trying to fix.

Rather than copying and pasting is there a way of clicking a button in my extension that adds text to the chat panel?

Thank you

Hey, not officially unfortunately, but you may be able to hack around and find a way to do it unofficially!

I’ve gone with this in the end that seems to be working well:

                   console.log("Adding to AI Chat...");
                    const originalClipboard = await vscode.env.clipboard.readText();
                    console.log("Original clipboard saved");
                    console.log("Opening new chat...");
                    await vscode.commands.executeCommand("aichat.show-ai-chat");
                    console.log("Waiting for chat window...");
                    await new Promise((resolve) => setTimeout(resolve, 500));
                    console.log("Setting clipboard with task description:", message.taskDescription);
                    await vscode.env.clipboard.writeText(message.taskDescription);
                    console.log("Pasting content...");
                    await vscode.commands.executeCommand("editor.action.clipboardPasteAction");
                    console.log("Restoring original clipboard");
                    await vscode.env.clipboard.writeText(originalClipboard);
                    console.log("Add to AI Chat complete");