You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that Ctrl+L in Codex for VS Code works well for regular file editors, but it does not work as expected for some non-file editors, such as notebook cells in .ipynb files and certain JSON editors in VS Code.
I expected Ctrl+L and Ctrl+Shift+L to attach selected content or the full document as context, ideally with line or cell metadata when available. However, this behavior seems to work only for regular file-based editors.
I would prefer this behavior to be supported natively in the official Codex VS Code extension, so I am sharing this here in case it is useful.
If someone on the Codex team sees this, please consider adding native support for these editors.
Thank you.
Codex Context Bridge
Codex Context Bridge is a local VS Code extension that restores Ctrl+L and Ctrl+Shift+L context attachment for editors that are not backed by a normal file: URI.
It exists for cases like:
notebook cells opened as vscode-notebook-cell
VS Code profile files such as keybindings.json opened as vscode-userdata
other virtual editors where the stock chatgpt.addToThread command silently does nothing
Why This Exists
The OpenAI Codex VS Code extension handles selected-line attachment through chatgpt.addToThread, but that path only works for file-backed editors.
This bridge keeps the default Codex behavior whenever it can:
normal files still go through the native OpenAI commands
non-file editors fall back to a temporary snapshot file
full-document attach stays visually minimal
partial selection attach keeps enough cell or line metadata to stay useful
Visual Examples
Selection attach from a notebook cell or VS Code profile JSON:
Full-document attach from a non-file editor:
Behavior
Ctrl+L
For file: editors, delegates to the native chatgpt.addToThread command.
For non-file editors, creates a temporary snapshot such as keybindings.json [Lines 12-18].md or svd_practice.ipynb [Cell 8, Line 1].md.
Ctrl+Shift+L
For file: editors, delegates to the native chatgpt.addFileToThread command.
For non-file editors, attaches the whole document through a temporary snapshot that uses only the source filename, for example svd_practice.ipynb.
Snapshot Lifecycle
The bridge writes temporary files only for non-file editors.
Snapshots live under %USERPROFILE%\.codex-context-bridge\snapshots
Each VS Code session gets its own snapshot folder
The current session folder is deleted when the extension session ends
Session folders older than one day are removed on startup
This keeps the behavior simple:
selected snippets remain readable in Codex
whole-document chips stay clean
snapshot files do not accumulate indefinitely under normal use
Repository Layout
package.json: local extension manifest
extension.js: command bridge and session-scoped snapshot handling
lib/snapshot.js: snapshot naming and content rules
scripts/install.ps1: installs the extension and updates keybindings
scripts/smoke-test.ps1: validates extension registration and keybinding wiring
tests/snapshot.test.js: Node-based unit tests for snapshot formatting
docs/assets/: README illustrations
Install Or Reapply
Run this after a Codex extension update or when reinstalling the bridge:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm Changgyun Ma from South Korea.
I noticed that Ctrl+L in Codex for VS Code works well for regular file editors, but it does not work as expected for some non-file editors, such as notebook cells in .ipynb files and certain JSON editors in VS Code.
I expected Ctrl+L and Ctrl+Shift+L to attach selected content or the full document as context, ideally with line or cell metadata when available. However, this behavior seems to work only for regular file-based editors.
As a workaround, I built a small VS Code extension called codex-context-bridge:
https://github.com/mack1210/codex-context-bridge
I would prefer this behavior to be supported natively in the official Codex VS Code extension, so I am sharing this here in case it is useful.
If someone on the Codex team sees this, please consider adding native support for these editors.
Thank you.
Codex Context Bridge
Codex Context Bridgeis a local VS Code extension that restoresCtrl+LandCtrl+Shift+Lcontext attachment for editors that are not backed by a normalfile:URI.It exists for cases like:
vscode-notebook-cellkeybindings.jsonopened asvscode-userdatachatgpt.addToThreadcommand silently does nothingWhy This Exists
The OpenAI Codex VS Code extension handles selected-line attachment through
chatgpt.addToThread, but that path only works for file-backed editors.This bridge keeps the default Codex behavior whenever it can:
Visual Examples
Selection attach from a notebook cell or VS Code profile JSON:

Full-document attach from a non-file editor:

Behavior
Ctrl+Lfile:editors, delegates to the nativechatgpt.addToThreadcommand.keybindings.json [Lines 12-18].mdorsvd_practice.ipynb [Cell 8, Line 1].md.Ctrl+Shift+Lfile:editors, delegates to the nativechatgpt.addFileToThreadcommand.svd_practice.ipynb.Snapshot Lifecycle
The bridge writes temporary files only for non-file editors.
%USERPROFILE%\.codex-context-bridge\snapshotsThis keeps the behavior simple:
Repository Layout
package.json: local extension manifestextension.js: command bridge and session-scoped snapshot handlinglib/snapshot.js: snapshot naming and content rulesscripts/install.ps1: installs the extension and updates keybindingsscripts/smoke-test.ps1: validates extension registration and keybinding wiringtests/snapshot.test.js: Node-based unit tests for snapshot formattingdocs/assets/: README illustrationsInstall Or Reapply
Run this after a Codex extension update or when reinstalling the bridge:
Then reload VS Code with
Developer: Reload Window.Keybindings
The installer writes these bindings:
Ctrl+L->codexContextBridge.addSelectionToThreadCtrl+Shift+L->codexContextBridge.addActiveDocumentToThreadNotes
README.md,.py, and other normal files still use the native Codex flow. That is why they can show the cleaner built-in chip from the OpenAI extension.Test Commands
Beta Was this translation helpful? Give feedback.
All reactions