Copy code locations from VS Code and paste them into coding agents as ready-to-use file references.
Features
- Copies the active file, selected lines, or every editor caret.
- Copies one or more selected files and folders from Explorer.
- Includes 1-based line numbers and handles selections ending at the start of the following line.
- Includes built-in profiles for Claude Code and Codex App.
- Supports custom profiles, templates, and multi-reference separators.
- Switches the active profile from the VS Code status bar.
Quick start
- Select Claude Code, Codex App, or a custom profile from the status bar.
- Select code in the editor, add multiple carets, or select files and folders in Explorer.
- Press Alt+C (Option+C on macOS) in the editor, or choose Copy Path for Agent from the editor or Explorer context menu.
- Paste the result into your coding-agent prompt.
Explorer multi-selection is available through the context menu because VS Code does not expose the Explorer selection to extension keybindings.
Built-in profiles
| Profile | Example output |
|---|---|
| Claude Code | @src/utils/auth.ts#L42-68 |
| Codex App | [auth.ts](https://github.com/zuozh11/copy-path-for-agent/blob/HEAD/absolute/path/src/utils/auth.ts:42-68) |
Profiles and settings
Click the profile name in the status bar or run Copy Path for Agent: Switch Copy Profile.
The command palette also provides commands to add, edit, and delete profiles. All settings are available under Settings → Extensions → Copy Path for Agent.
Each profile has:
- A unique ID and display name.
- A reference template.
- A space or newline separator for multiple references.
Template variables
| Variable | Value |
|---|---|
{relativePath} |
Workspace-relative file or folder path. |
{absolutePath} |
Absolute path from the current VS Code environment. |
{relativeDirectory} |
Workspace-relative parent directory. |
{absoluteDirectory} |
Absolute parent directory. |
{fileName} |
File or folder name. |
{startLine} |
1-based start line, or empty when unavailable. |
{endLine} |
1-based end line, or empty when unavailable. |
{lineRange} |
A line or range such as 5 or 5-10. |
{fileUri} |
The VS Code resource URI. |
Optional sections prevent punctuation from appearing when a value is empty:
@{relativePath}{{#lineRange}}#L{lineRange}{{/lineRange}}
Source and JetBrains version
The source code and the JetBrains version are maintained in the same GitHub repository.