Skip to content

Agents window: Shift+Enter inserts a new line in feedback comments - #350921

Draft
Alexandru Dima (alexdima) wants to merge 1 commit into
mainfrom
agents/fix-347298-feedback-shift-enter
Draft

Alexandru Dima (alexdima) wants to merge 1 commit into
mainfrom
agents/fix-347298-feedback-shift-enter

Conversation

@alexdima

Copy link
Copy Markdown
Member

Fixes #347298

Problem

In the Agents window, the inline Add Comment input in the Changes diff editor sends the comment when you press Shift+Enter, so you can't write a multi-line comment. There was also a second problem: a comment that did contain a newline showed as one line on its card, because markdown folds a single line break into the same paragraph.

Change

  1. agentFeedbackEditorInputContribution.ts: the textarea's keydown handler now lets Shift+Enter through, so the textarea inserts the new line. Enter while an IME is composing is let through too, so it commits the IME text instead of submitting half-composed text. Enter still adds the comment and Alt+Enter keeps its existing behavior.
  2. agentFeedbackEditorWidget.ts: comments the user wrote render with { gfm: true, breaks: true }, the same option chat uses for request text, so their line breaks show on the card. Agent-authored comments render exactly as before.

Each part has its own regression test.

Before / After

Same scenario: type line one, press Shift+Enter, type line two, press Enter.

  • Before (Insiders 1.147.0, Linux): Shift+Enter submits line one and closes the input (step S4 fails).
  • After (Dev build of this branch): the input grows to two lines, and Enter adds a card that shows line one and line two on separate lines (S1–S5 pass).
347298-before-after-side-by-side.mp4

How I tested

Command Result
scripts/test.sh --grep "Shift\+Enter keeps typing|line breaks of a multi-line" with the two source files reverted to main 0 passing, 2 failing (both new tests catch the bug)
Same command on this branch 2 passing
scripts/test.sh --grep AgentFeedback 174 passing
pnpm run oxlint on the 4 changed files clean
pnpm run typecheck-client clean
UI scenario on installed Insiders 1.147.0 fails at S4 (Shift+Enter submitted the comment)
UI scenario on --dev build of this branch passes S1–S5

The scenario checks DOM state, not screenshots: S4 reads the textarea value and visibility after Shift+Enter, and S5 reads the rendered card text.

Before / after

Before

347298-before-insiders.mp4

After

347298-after-dev.mp4

🤖 Authored with GitHub Copilot on behalf of Alexandru Dima (@alexdima).

Shift+Enter, and Enter during IME composition, no longer submit the
inline feedback input; the textarea inserts the new line. Comments
written by the user render with markdown line breaks so the lines show
on the card. Agent-authored comments render as before.

Fixes #347298

🤖 Authored with GitHub Copilot on behalf of @alexdima.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 28, 2026 20:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the changes enabling multiline feedback comments.

No open issues 🎉

What changed in this PR

Fixes #347298 by allowing multiline feedback comments in the Agents window’s Changes diff editor and preserving their line breaks on comment cards.

Changes:

  • Lets Shift+Enter insert a newline and composing Enter commit input without submitting.
  • Preserves line breaks in user-authored comments while leaving agent-authored rendering unchanged.
  • Adds regression tests for keyboard handling and multiline rendering.

No actionable findings remain.

File Description
src/​vs/​sessions/​contrib/​agentFeedback/​test/​browser/​agentFeedbackEditorWidget.test.ts Tests that multiline user comments retain visible line breaks.
src/​vs/​sessions/​contrib/​agentFeedback/​test/​browser/​agentFeedbackEditorInputContribution.test.ts Tests Shift+Enter passthrough and Enter submission.
src/​vs/​sessions/​contrib/​agentFeedback/​browser/​agentFeedbackEditorWidget.ts Enables preserved line breaks for user-authored markdown.
src/​vs/​sessions/​contrib/​agentFeedback/​browser/​agentFeedbackEditorInputContribution.ts Prevents submission on Shift+Enter and composing Enter.

Review effort: Balanced

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agents window comment widget doesn't allow to create a new line with shift+enter

2 participants