Go to Clipboard File
VS Code extension that parses file:line references from your clipboard and opens them directly in the editor. Perfect for jumping to specific locations from stacktraces, error logs, test outputs, and any text containing file paths with line numbers.
For example, if your clipboard contains:
Error: Something went wrong
at Object.<anonymous> (/src/index.js:42:15)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
Then in this repository it will show:

What it does
- Reads your clipboard for file:line references
- Parses multiple formats including Python stacktraces, JavaScript stack traces, and generic file:line patterns
- Resolves file paths intelligently - checks absolute paths first, then workspace-relative paths
- Opens files directly at the specified line and column (when available)
- Shows selection dialog when multiple references are found
- Falls back to Quick Open when no file references are detected
- Python stacktraces:
File "/path/to/file.py", line 42
- JavaScript/Node stacktraces:
at function (/path/to/file.js:123:45)
- Generic file:line patterns:
file.txt:123
, src/app.py:45:12
, ./relative/path.js:10
- Absolute and relative paths: Works with both
/absolute/paths
and relative/paths
Keyboard Shortcut
- Windows/Linux:
Ctrl+Shift+G
- Mac:
Cmd+Shift+G
Local Installation
Prerequisites
- Node.js (v16 or higher)
- npm
- VS Code
Build from Source
- Clone the repository:
git clone https://github.com/StefanoChiodino/go-to-clipboard-file.git
cd go-to-clipboard-file
- Install dependencies:
npm install
- Compile the extension:
npm run compile
- Package the extension:
npm run package
This creates a .vsix
file in the project directory.
Install the Extension
Option 1: Install via Command Line
code --install-extension go-to-clipboard-file-<version>.vsix
Option 2: Install via VS Code UI
- Open VS Code
- Go to Extensions view (
Ctrl+Shift+X
)
- Click the
...
menu at the top of the Extensions view
- Select "Install from VSIX..."
- Browse to and select the
.vsix
file
Development
To run the extension in development mode:
- Open the project in VS Code
- Press
F5
to launch a new Extension Development Host window
- The extension will be available in the new window
To watch for changes during development:
npm run watch
Usage
- Copy text with file references - Copy any text containing file paths with line numbers (stacktraces, error logs, etc.)
- Use the keyboard shortcut - Press
Ctrl+Shift+G
(Windows/Linux) or Cmd+Shift+G
(Mac)
- Select file if needed - If multiple valid files are found, pick from the dialog (most recent entries shown first)
- Navigate instantly - VS Code opens the file and jumps to the exact line and column
Pro tips:
- Works with any text format containing
filename:line
or filename:line:column
patterns
- Automatically filters out non-existent files from selection
- Falls back to Quick Open (
Ctrl+P
) if no file references are detected
- Configure
stripPrefixes
to handle Docker/container paths that don't match your local filesystem
Example Stacktraces
The extension can parse stacktraces like:
Python:
Traceback (most recent call last):
File "/path/to/file.py", line 287, in run
return self.execute()
File "/another/file.py", line 61, in execute
return action(**match)
JavaScript/Node:
Error: Something went wrong
at Object.<anonymous> (/src/index.js:42:15)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
Generic:
Error in src/components/Button.tsx:45
Failed at utils/helper.js:123:8
Try it out
Test the extension immediately with these examples from this repository. Copy any line below, then press Ctrl+Shift+G
(or Cmd+Shift+G
on Mac):
src/extension.ts:15
src/parser.ts:42
package.json:5
tsconfig.json:8
README.md:25
src/test/suite/extension.test.ts:10
Or copy this mock Python stacktrace:
Traceback (most recent call last):
File "src/extension.ts", line 25, in activate
registerCommand()
File "src/parser.ts", line 68, in parseClipboard
return extractFiles()
Or this JavaScript error format:
Error occurred:
at activate (src/extension.ts:31:12)
at parseFileReferences (src/parser.ts:89:5)
at Object.<anonymous> (package.json:1:1)
The extension will parse these and let you jump directly to the files in this repository!
Configuration
You can configure the extension by adding settings to your VS Code settings:
{
"go-to-clipboard-file.stripPrefixes": [
"/app/",
"/workspace/",
"/usr/src/app/",
"C:\\container\\"
]
}
Settings
go-to-clipboard-file.stripPrefixes
: Array of path prefixes to strip from file paths. Useful for handling container paths that VS Code wouldn't otherwise recognize.
How file resolution works
The extension intelligently resolves file paths in this order:
- Absolute paths: If the path starts with
/
or C:\
, checks if the file exists directly
- Strip configured prefixes: Removes prefixes like
/app/
, /workspace/
(see Configuration)
- Workspace relative: Tries the path relative to each workspace folder
- Pre-validation: Only shows files that actually exist on disk in selection dialogs
Key behaviors:
- Skips non-existent files from selection dialogs
- If only one valid file remains after filtering, opens it directly
- Preserves line and column information for precise navigation
- Shows most recent stacktrace entries first in selection dialog
Testing
Run the test suite:
npm test
Note: VS Code integration tests require a display server. On headless Linux, run tests in CI (e.g., GitHub Actions using xvfb), or run only non-Electron unit tests locally.
License
MIT