code-reference
Small VS Code extension for copying selected code locations in a Codex-friendly format.
Commands
Copy Code Reference: Line Range
packages/foo/bar.ts#L16-16
Copy Code Reference: Line + Column Range
packages/foo/bar.ts#L16C34-16C49
Send Code Reference to Codex: Line Range
Send Code Reference to Codex: Line + Column Range
Send Relative Path to Codex from the Explorer file tree or editor tab context menu
Default Shortcuts
Cmd+Alt+L: copy line range
Cmd+Alt+C: copy line + column range
Cmd+Alt+Shift+L: send line range to Codex
Cmd+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 the Codex macOS 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.