IDE Extension: support inserting the current editor selection into chat as an explicit reference(like cursor)

Resolved 💬 2 comments Opened Jun 4, 2026 by jiangjian224-art Closed Jun 4, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What variant of Codex are you using?

IDE Extension

What feature would you like to see?

I’d like the IDE extension to support inserting the current editor selection into the Codex chat composer as an explicit reference.

For example, when I select a range in a file, I’d like to send that selection to Codex in a visible and structured way, such as:

requirements.txt (15-16)
src/foo.py (120-148)

Just like how cursor does:

<img width="2548" height="228" alt="Image" src="https://github.com/user-attachments/assets/f48194a0-6fa2-4550-be35-cc49540bd921" />

Codex already seems to use active file / selection as IDE context, which is helpful. But an explicit reference would be much better when I want precise control over what context is being passed to the agent.

This would be especially useful for:

code review
refactors
explain-this-code requests
reducing ambiguity when multiple files are open

A shortcut or command to trigger this would be great, but the main request is the feature itself: selected code should be insertable into the chat composer as an explicit reference, not only as implicit IDE context.

Additional information

_No response_

View original on GitHub ↗

2 Comments

etraut-openai contributor · 2 months ago

The IDE extension already supports this in the form of the "Add to Codex Thread" command. You can assign a keybinding of your choice to this command.

jiangjian224-art · 2 months ago

Thanks — that fully answers my question.
I didn’t realize the IDE extension already supports.

Appreciate the clarification.