[FEATURE] Support Code Selection from IntelliJ Diff View

Resolved 💬 3 comments Opened Apr 29, 2026 by sanskar-agrawal2018 Closed May 3, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Feature Request: Support Code Selection from IntelliJ Diff View

Summary

Claude Code CLI cannot capture selected code when the active editor in IntelliJ IDEA is a diff/compare view. It only works when a standard file editor tab is active.

Environment

  • IDE: IntelliJ IDEA
  • Terminal: IntelliJ built-in terminal
  • Tool: Claude Code CLI

Current Behavior

When a user selects code inside IntelliJ's diff view (e.g., during a Git diff, merge conflict, or file comparison) and tries to reference or send that selection to Claude Code CLI in the terminal, Claude Code does not pick up the selected text.

Expected Behavior

Claude Code CLI should be able to read the selected code from IntelliJ's diff editor, just as it does from a regular file editor tab.

Why It Breaks

IntelliJ's diff view is a virtual/special editor that does not expose selected text and active file context to the shell environment in the same way a standard editor tab does. Claude Code currently has no hook into IntelliJ's diff editor API to capture this context.

Proposed Solution

Either:

A Claude Code IntelliJ plugin that integrates with IntelliJ's diff editor API (DiffViewer, EditorEx) to capture selections and pass them to the CLI, or
Support for a manual context flag like claude --stdin so users can pipe selected diff content directly from the IDE into Claude Code

Alternative Solutions

Users must:

Manually copy the code from the diff view and paste it into the Claude Code prompt, or
Press F4 to jump to the source file and select the code from a regular editor tab

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

This affects all IntelliJ-family IDE users (IntelliJ IDEA, PyCharm, WebStorm, GoLand, etc.) who use Claude Code CLI inside the built-in terminal and frequently work with diffs (code reviews, merge conflicts, Git comparisons).

Additional Context

This feature would be especially valuable for code review workflows where users want to quickly ask Claude about specific changed lines without leaving the diff view.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗