VS Code extension: strip trailing newline when copying fenced code blocks (or make it configurable)
Resolved 💬 1 comment Opened May 20, 2026 by glen-84 Closed Jun 18, 2026
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:
- 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.
- 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)._
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗