claude-code - 💡(How to fix) Fix VS Code extension: strip trailing newline when copying fenced code blocks (or make it configurable)

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…
RAW_BUFFERClick to expand / collapse

Problem Statement

In the Claude Code VS Code native extension, fenced code blocks in Claude's responses render with a copy affordance. When I click it, the clipboard ends up with a trailing \n after the final line of content.

That's fine for multi-line scripts, but it's frequently annoying when the copied artifact is destined for a single-line input — a CLI prompt, a branch-name field, a commit-message subject, an issue title, etc. — where the trailing newline either submits the form prematurely or has to be manually deleted.

Proposed Solution

Two options, in order of preference:

  1. Strip the trailing newline by default. Users who want one back can add it themselves; users who don't want it (the more common case for me) get the right behavior for free.
  2. Make it configurable via a setting (e.g., claudeCode.copy.trimTrailingNewline) so each user can pick their default.

Either would be a small UX win and shouldn't affect anything else.

Related

  • #48641 — request for the copy affordance itself in the VS Code extension. This issue is a follow-up on the behavior of that affordance.

Drafted by Claude (Anthropic AI assistant).

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