Context Link (VSCode Extension)


Simple VSCode extension to:
Copy to the clipboard file paths with line references to use as context with AI assistants like Claude, OpenCode etc.
Features
- Copy file path with line references in one keystroke
- Support for both Claude and OpenCode formats
- Works with selections or entire files
- Context menu integration
Usage
- Open a file in VS Code
- Select lines (optional)
- Press
Ctrl+Alt+U (Windows/Linux) or Cmd+Alt+U (macOS)
- The context link is copied to clipboard
| Format |
No Selection |
Single Line |
Line Range |
| Claude |
@path/file |
@path/file#L10 |
@path/file#L10-20 |
| OpenCode |
@path/file |
path/file:10 |
path/file:10-20 |
Extension Settings
This extension contributes the following settings:
contextLink.format: Output format for the context link
claude (default): Claude format with @ prefix and #L for lines
opencode: OpenCode format with : for line references
contextLink.showNotification: Show a notification when the context link is copied (default: false)
contextLink.pathType: Path type for the context link
relative (default): Relative path from workspace root
absolute: Absolute file system path
Keyboard Shortcuts
| Command |
Windows/Linux |
macOS |
| Copy Context Link |
Ctrl+Alt+U |
Cmd+Alt+U |
Right-click in the editor and select "Copy Context Link" from the context menu.
Use with AI Assistants
Paste the copied link into your AI assistant to provide context:
Check the error handling in @src/utils/parser#L45-60
The AI assistant will understand the file path and line references, making it easier to discuss specific code sections.
| |