Skip to content

[BUG] New agent view functionality breaks send to CC #249

Open

Description

@aksdad

Bug Description

When using the the new agents view mode, selecting text to send to Claude doesn't result in anything being sent to it. Also, the current file information doesn't get passed through to it either.

To Reproduce

Steps to reproduce the behavior:

  1. Open an agent from the agent view
  2. Select text and try to send it to claude code (as)
  3. Nothing happens

Expected Behavior

Claude should receive the filename and line number

Environment

  • Neovim version: 11.6
  • Claude Code CLI version: 2.1.140
  • OS: Tahoe 26.4.1
  • Plugin version: commit 102d835

Error Messages

None

If applicable, add error messages or logs.

Paste any error messages here

Additional Context

Add any other context about the problem here.

Activity

  1. ThomasK33 commented on Jun 3, 2026

    @ThomasK33
    Member

    Thanks for the detailed report. I traced the point where the chain breaks.

    TL;DR: This isn't a claudecode.nvim send-path bug. The plugin still sends your selection and current-file info correctly over the IDE WebSocket; the notifications are being dropped on the Claude Code CLI side while the agents view is focused.

    The plugin still sends

    <leader>as / :ClaudeCodeSend broadcasts an at_mentioned notification, and selection/file tracking broadcasts selection_changed (active file + selection). I verified both still go out by swapping the claude binary for a small fake IDE client that does the same discovery + WebSocket handshake the real CLI does and logs what it receives:

    RECV selection_changed  filePath=.../sample.lua  isEmpty=false  line=0..7
    RECV at_mentioned       filePath=.../sample.lua  lineStart=0 lineEnd=7
    

    Both arrive at the connected IDE client — so the producer side is fine.

    Where it breaks

    In the Claude Code CLI (checked 2.1.161), the at_mentioned handler is gated on the currently-focused IDE client:

    handler extracted from the CLI binary
    useEffect(() => {
      let O = xu(H);                  // IDE client for the focused context
      if (q.current !== O) q.current = O;
      if (O) O.client.setNotificationHandler(zF3(), (T) => {
        if (q.current !== O) return;  // <-- dropped when the focused context isn't this client
        // ... insert @mention into the prompt ...
      });
    });

    When the agents view is focused, the active context is re-scoped, so the notification arriving on the IDE connection hits a now-stale handler and is silently discarded. That also explains why the current-file info stops coming through. The plugin only has one connection and can't see or influence which agent Claude has focused, so there's no plugin-side fix.

    Workaround

    Disable the agents view (or switch back to the main chat view before sending). The CLI exposes a toggle:

    CLAUDE_CODE_DISABLE_AGENT_VIEW=1
    

    You can set it straight from the plugin config so it's always applied to the Claude terminal:

    require("claudecode").setup({
      env = { CLAUDE_CODE_DISABLE_AGENT_VIEW = "1" },
    })

    With the agents view off, send-to-CC works as before.

    I'd also suggest filing this upstream with Claude Code, as inbound IDE at_mentioned / selection_changed should apply to the IDE-connected session (or be forwarded to the focused agent) regardless of the agents’ view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions