Fix VS Code Copilot Chat deep links#1198
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughUpdates platform definitions and URL builders across CLI, Raycast extension, and React component to support VS Code and VS Code Insiders deeplinks to Copilot Chat. Each entry point now generates URLs with encoded prompt query parameters for these platforms, validated by a new test suite. ChangesCopilot Chat deeplink support
🎯 2 (Simple) | ⏱️ ~12 minutes ✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the “Run” integrations so the VS Code / VS Code Insiders options generate Copilot Chat deep links with the prompt prefilled (instead of just launching the editor), and adds a small regression test for the generated URLs in the packaged CLI library.
Changes:
- Update VS Code and VS Code Insiders platform base URLs to target Copilot Chat deep links (web UI, CLI platform builder, Raycast extension).
- Extend the URL builders to append the encoded prompt for VS Code deep links.
- Add a Vitest regression test to validate VS Code URL generation and encoding.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/components/prompts/run-prompt-button.tsx | Updates VS Code/Insiders “Run” targets and deep-link URL building in the web UI. |
| packages/raycast-extension/src/utils.ts | Updates Raycast platform definitions and URL building for VS Code/Insiders deep links. |
| packages/prompts.chat/src/cli/platforms.ts | Updates the packaged CLI platform list and URL builder for VS Code/Insiders deep links. |
| packages/prompts.chat/src/tests/platforms.test.ts | Adds regression coverage for VS Code deep-link URL generation/encoding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { id: "vscode", name: "VS Code", baseUrl: "vscode://GitHub.Copilot-Chat/chat", isDeeplink: true }, | ||
| { id: "vscode-insiders", name: "VS Code Insiders", baseUrl: "vscode-insiders://GitHub.Copilot-Chat/chat", isDeeplink: true }, |
| name: "VS Code", | ||
| baseUrl: "vscode://", | ||
| supportsQuerystring: false, | ||
| baseUrl: "vscode://GitHub.Copilot-Chat/chat", |
| name: "VS Code Insiders", | ||
| baseUrl: "vscode-insiders://", | ||
| supportsQuerystring: false, | ||
| baseUrl: "vscode-insiders://GitHub.Copilot-Chat/chat", |
| { id: "vscode", name: "VS Code", baseUrl: "vscode://GitHub.Copilot-Chat/chat", isDeeplink: true }, | ||
| { id: "vscode-insiders", name: "VS Code Insiders", baseUrl: "vscode-insiders://GitHub.Copilot-Chat/chat", isDeeplink: true }, |
| expect(vscode?.baseUrl).toBe('vscode://GitHub.Copilot-Chat/chat'); | ||
| expect(insiders?.baseUrl).toBe('vscode-insiders://GitHub.Copilot-Chat/chat'); | ||
|
|
||
| expect(buildUrl('vscode', vscode!.baseUrl, 'Review this code & explain it')).toBe( | ||
| 'vscode://GitHub.Copilot-Chat/chat?prompt=Review%20this%20code%20%26%20explain%20it', | ||
| ); | ||
| expect(buildUrl('vscode-insiders', insiders!.baseUrl, '/fix failing tests')).toBe( | ||
| 'vscode-insiders://GitHub.Copilot-Chat/chat?prompt=%2Ffix%20failing%20tests', | ||
| ); |
Description
The Run button listed VS Code and VS Code Insiders, but those entries only opened the editor and required users to paste the prompt manually. This updates both entries to use the GitHub Copilot Chat URI handler so prompts open prefilled in VS Code or VS Code Insiders.
The same deep-link behavior is wired through the web Run button, the packaged CLI platform builder, and the Raycast extension utility. A small regression test covers the generated VS Code URLs and prompt encoding.
Type of Change
Please don't edit
prompts.csvdirectly!Instead, visit prompts.chat and:
This ensures proper attribution, formatting, and keeps the repository in sync. You'll also appear on the Contributors page!
Additional Notes
Validation run:
npm run lint -- --quietnpm --prefix packages/prompts.chat run typecheckcd packages/prompts.chat && npx vitest run --config /dev/null src/__tests__/platforms.test.tsFix VS Code Copilot Chat Deep Links
Overview
This PR fixes VS Code and VS Code Insiders deep links to use the GitHub Copilot Chat URI handler, enabling prompts to open prefilled directly in the editors rather than requiring manual pasting. The fix is applied consistently across the web UI, CLI, and Raycast extension.
Changes Made
Platform Configuration Updates
vscode://tovscode://GitHub.Copilot-Chat/chatwithisDeeplink: truevscode-insiders://tovscode-insiders://GitHub.Copilot-Chat/chatwithisDeeplink: trueURL Generation
Extended the
buildUrl()function in all affected modules to handle VS Code platforms by generating URLs in the format${baseUrl}?prompt=${encoded}, properly encoding special characters in prompt text.Affected Components
src/components/prompts/run-prompt-button.tsx)packages/prompts.chat/src/cli/platforms.ts)packages/raycast-extension/src/utils.ts)Test Coverage
packages/prompts.chat/src/__tests__/platforms.test.ts): Verifies VS Code and VS Code Insiders platform configurations, validates baseUrl values, and tests thatbuildUrl()correctly generates URL-encoded prompt query strings with proper handling of special characters (e.g., ampersands, forward slashes)Validation
All validation checks passed: