Small VS Code extension for copying selected code locations in a Codex-friendly format.
Commands
Copy Code Reference: Line Rangepackages/foo/bar.ts#L16-16
Copy Code Reference: Line + Column Rangepackages/foo/bar.ts#L16C34-16C49
Send Code Reference to Codex: Line RangeSend Code Reference to Codex: Line + Column RangeSend Relative Path to Codexfrom the Explorer file tree or editor tab context menu
Default Shortcuts
Cmd+Alt+L: copy line rangeCmd+Alt+C: copy line + column rangeCmd+Alt+Shift+L: send line range to CodexCmd+Alt+Shift+C: send line + column range to Codex
On Windows/Linux, use Ctrl instead of Cmd.
Codex Sync
VS Code extensions cannot reliably write directly into another app's input box through an official Codex API. This extension therefore provides two practical paths:
macos-osascript(default): copies the reference, activates theCodexmacOS app, waits only until it becomes frontmost, and pastes into the focused field. macOS may ask VS Code for Accessibility/Automation permission.custom-command: runs a shell command that you control. The command can use placeholders such as${reference},${file},${lineStart}, and${kind}.
If sync is not available, the reference is still copied to the clipboard.
Settings
{
"codexCodeReference.pathStyle": "workspace-relative",
"codexCodeReference.codexSync.strategy": "macos-osascript",
"codexCodeReference.codexSync.appName": "Codex",
"codexCodeReference.codexSync.submitAfterPaste": false,
"codexCodeReference.codexSync.pasteDelayMs": 80,
"codexCodeReference.codexSync.frontmostTimeoutMs": 1500,
"codexCodeReference.codexSync.customCommand": ""
}
Development
npm install
npm run compile
Press F5 in VS Code to launch an Extension Development Host.