claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Line Number Indexing Mismatch in IntelliJ IDEA Integration

Open bertwin opened this issue 4 months ago • 3 comments

Bug Description When selecting a line in IntelliJ IDEA, claude gets the line number wrong. It probably gets it zero based. So when line 5 is selected, it reports that line 4 is selected when asked.

Environment Info

  • Platform: linux
  • Terminal: pycharm
  • Version: 1.0.88
  • Feedback ID: c59f3d2e-7089-47b5-9aa0-e9d220473774

Errors

[{"error":"Error: Could not find plugin directories for pycharm\n    at ZAB (file:///home/bertwin/.local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1831:29994)\n    at $y6 (file:///home/bertwin/.local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1832:5007)\n    at Ey6 (file:///home/bertwin/.local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1832:2193)\n    at file:///home/bertwin/.local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1833:3094\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-08-22T20:17:16.421Z"}]

bertwin avatar Aug 22 '25 20:08 bertwin

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/1828
  2. https://github.com/anthropics/claude-code/issues/3562
  3. https://github.com/anthropics/claude-code/issues/1316

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 22 '25 20:08 github-actions[bot]

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 04 '25 10:12 github-actions[bot]

The issue is still occurring, a workaround is to add a reminder about this in .claude/CLAUDE.md.

It will then respond like this when asked which line is selected:

● According to the system reminder, line 149 is selected (0-based indexing), which corresponds to line 150 in
   1-based indexing.

  (The text appears to be truncated in the reminder, but this is line 150 when using standard 1-based line
  numbering that most tools expect.)

The real use case, of course, is not asking which line number is selected, but other tool calls, like getting symbol information about the symbol at a specific line/col. Without the workaround this always fails because the tools expect a 1-based line number.

bertwin avatar Dec 12 '25 13:12 bertwin