Skip to content

Selection as Context

Open in ChatGPT ↗
Ask ChatGPT about this page
Open in Claude ↗
Ask Claude about this page
Copied!

Attach text or diffs directly from Warp’s editor or Code Review panel as context for your Agent prompts.

Attaching selections from Warp’s native code editor

Section titled “Attaching selections from Warp’s native code editor”

When you have Warp’s native code editor open beside a regular pane, you can easily attach specific lines of code as context:

  1. Select text in the editor. A tooltip will appear in the bottom-right corner of the selection.
  2. Add as context by clicking the tooltip or using the keyboard shortcuts Cmd + L (macOS) or CTRL + SHIFT + L (Windows or Linux).
  3. Warp automatically adds the relative file path and context, in addition to the line numbers of the hunk, as a formatted string into the prompt.

This makes it easy to highlight just the lines you want the Agent to analyze or modify.

Selecting a function and attaching it as context from Warp's native code editor.

Attaching selections from Warp’s Code Review panel

Section titled “Attaching selections from Warp’s Code Review panel”

You can also directly attach context from the Code Review panel:

  1. Hover over any diff hunk to reveal the option to attach it as context.

On-hover option to attach diff as context into the prompt.

  1. Attaching a diff will automatically insert the relevant file path and changed lines into your prompt.

This helps the Agent understand exactly what has been modified, making it easier to request explanations, feedback, or follow-up edits.

Code Review panel with diffs for review.

Attaching code to a third-party agent session

Section titled “Attaching code to a third-party agent session”

You can select code, files, or snippets and feed them directly to a running third-party CLI agent session without copy-pasting or switching tools.

When a third-party agent (Claude Code, Codex, OpenCode, etc.) is running in a Warp tab, select text in Warp’s code editor or Code Review panel and attach it as context to that agent’s session using Cmd + L (macOS) or CTRL + SHIFT + L (Windows/Linux). This works the same way as attaching context to Warp’s built-in Agent.

For more on third-party agent support, see Third-Party CLI Agents.