Three days ago I was sitting on yet another ChatGPT session, spending more time explaining where my code lives than actually asking the question. Not a tragedy — just annoying. I don't have a lot of time, and I didn't want to waste it on copy-paste rituals.
Googled for something that already solved this. Nothing useful. So I spent three evenings building it myself.
The extension is called Copy Code to ChatGPT. It adds a right-click menu in VS Code that copies your code the way AI actually needs it — with the file path, line numbers, and proper Markdown formatting. Not just the raw snippet.
So instead of pasting this:
export function formatOutput(code, filePath) {
// ...
}
...and then typing "this is from utils/formatter.ts around line 45, it's TypeScript, the context is..." — you just paste and the AI already knows where it came from.
You can also copy entire folders as a single block, grab the project structure as a tree, and see the token count before sending so you don't hit the limit mid-conversation. There's also basic import-following — point at a file and it pulls in related files by tracing dependencies. Not perfect, but already way more useful than copying things manually.
I published it on the VS Code Marketplace and on GitHub. It's free, open source, no telemetry.
If you work with AI assistants daily and have a better approach to this — genuinely curious what you're doing.
Top comments (0)