claude-code - 💡(How to fix) Fix Add setting to disable auto-attach of IDE selection context [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46370Fetched 2026-04-11 06:22:04
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Code Example

"claudeCode.autoAttachSelection": false
RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

Problem Statement

When text is selected in the editor, the Claude Code VS Code extension automatically attaches it as context (shown as "N lines selected" in the input box). There is no way to disable this by default — you have to click the eye-slash toggle every time.

In large codebases, I frequently have text selected from navigating/reading code, and it gets attached unintentionally, adding noise to prompts.

Proposed Solution

Add a VS Code extension setting like:

"claudeCode.autoAttachSelection": false

When false, editor selections are not auto-attached. Users can still manually attach selections via Ctrl+Esc or the attachment button.

Alternative Solutions

No response

Priority

Medium - Would be very helpful

Feature Category

Configuration and settings

Use Case Example

No response

Additional Context

No response

extent analysis

TL;DR

Add a VS Code extension setting to disable automatic attachment of selected text as context by default.

Guidance

  • Consider adding a boolean setting like "claudeCode.autoAttachSelection" to the extension's configuration to allow users to opt-out of automatic attachment.
  • When the setting is false, ensure that editor selections are not auto-attached, but still allow manual attachment via keyboard shortcuts or buttons.
  • Verify that the new setting is properly documented and exposed in the extension's settings UI.
  • Test the new setting with various selection scenarios to ensure it works as expected and reduces unintentional noise in prompts.

Example

{
  "claudeCode.autoAttachSelection": false
}

This example shows how the new setting could be configured in the user's VS Code settings.

Notes

The proposed solution assumes that the extension's architecture allows for easy addition of new settings and modification of the auto-attachment behavior. If the extension's codebase is complex or has dependencies that could affect this change, additional analysis may be required.

Recommendation

Apply workaround by adding the proposed setting, as it provides a flexible solution for users to control the auto-attachment behavior, addressing the reported issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING