Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call GitHub Copilot Chat from my VS Code extension?

I want to write a vscode extension that can launch/trigger GitHub Copilot Chat to the do prompt. The expected use case looks like this:

  1. User select a piece of code
  2. User execute Source Action with my command, then my command able to send custom prompt to input box of the GitHub Copilot Chat and send it to get results.

Is that possible at this moment?

like image 613
Will Huang Avatar asked Oct 23 '25 21:10

Will Huang


1 Answers

If you want to send a custom prompt to copilot chat you should use workbench command from extension

const prompt = `write two sum with test cases in javascript `
vscode.commands.executeCommand('workbench.action.chat.open', prompt );

like image 113
hannad rehman Avatar answered Oct 26 '25 02:10

hannad rehman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!