English | 中文
A VS Code extension that sends your selected code to GitHub Copilot Chat as a native file attachment with a single keyboard shortcut.
- One key shortcut — Press
Ctrl+L(Windows/Linux) orCmd+L(Mac) to attach selected code directly to Copilot Chat. - Toggle focus — Press the same shortcut while Copilot Chat input is focused to return focus to the editor.
- Native attachment chips — Uses VS Code's built-in
attachFilesAPI so attachments appear as clickable label chips, fully understood by Copilot. - Multi-selection support — Hold
Altand select multiple ranges; each becomes a separate attachment chip. - Two modes — Simple (chip only) or Full (chip + selected text pre-filled as a query).
- Smart path resolution — Uses workspace-relative paths when available, falls back to absolute paths for files outside the workspace.
- VS Code
^1.85.0 - GitHub Copilot Chat extension installed and signed in.
- Open any file in the editor.
- Select the code you want to send (single or multiple selections).
- Press
Ctrl+L/Cmd+L. - Copilot Chat opens (or gains focus) with your file attachment chip ready — type your question and press
Enter. - Press
Ctrl+L/Cmd+Lagain while in the chat input to return focus to the editor.
| Platform | Default Shortcut |
|---|---|
| Windows/Linux | Ctrl+L |
| macOS | Cmd+L |
Tip: The keybinding only fires when the text editor has focus and text is selected, so it won't conflict with terminal or other panel shortcuts.
To customize the shortcut, open File → Preferences → Keyboard Shortcuts and search for Copilot: Send to Copilot Chat.
The extension registers keybindings in package.json, but other extensions (e.g. GitHub Copilot Chat itself) may override Cmd+L / Ctrl+L. If the shortcut doesn't work, add the following to your user keybindings.json (open via Command Palette → Preferences: Open Keyboard Shortcuts (JSON)):
Note: User-level keybindings have the highest priority and will override any conflicting bindings from extensions.
| Setting | Type | Default | Description |
|---|---|---|---|
sendToCopilot.mode |
string | simple |
simple — attachment chip only. |
full — chip + selected text as query. |
Open Settings (Ctrl+,) and search for sendToCopilot.mode, or add to settings.json:
"sendToCopilot.mode": "full"| Problem | Solution |
|---|---|
Nothing happens when pressing Ctrl+L |
Make sure the text editor has focus and text is selected. |
| Shortcut doesn't work / conflicts | Add the recommended keybindings to your user keybindings.json. |
| "GitHub Copilot Chat is not installed" error | Install the GitHub Copilot Chat extension. |
| Chat opens but no attachment chip appears | Ensure your VS Code version is ≥ 1.85 and Copilot Chat is up to date. |
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch for changes
npm run watch
# Press F5 in VS Code to launch Extension Development HostMIT