Skip to content

Fix newline formatting in terminal suggest details widget#286584

Merged
meganrogge merged 2 commits intomainfrom
copilot/fix-terminal-suggest-formatting
Jan 8, 2026
Merged

Fix newline formatting in terminal suggest details widget#286584
meganrogge merged 2 commits intomainfrom
copilot/fix-terminal-suggest-formatting

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 8, 2026

The terminal suggest details widget's explain mode displayed valueSelection and index fields on the same line due to an escaped newline literal (\\n) instead of an actual newline character (\n).

Changes

  • Fixed line 145 in simpleSuggestWidgetDetails.ts to use \n instead of \\n when building the markdown string for explain mode details

Before:

md += `valueSelection: ${vs ? `[${vs[0]}, ${vs[1]}]` : 'undefined'}\\n`;

After:

md += `valueSelection: ${vs ? `[${vs[0]}, ${vs[1]}]` : 'undefined'}\n`;

This ensures proper line breaks in the rendered code block, matching the formatting of other fields (score, prefix, index).

Original prompt

This section details on the original issue you should resolve

<issue_title>terminal suggest details widget has formatting issue</issue_title>
<issue_description>There should be a newline between valueSelection and index

Image

</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…valueSelection and index

Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix formatting issue in terminal suggest details widget Fix newline formatting in terminal suggest details widget Jan 8, 2026
Copilot AI requested a review from meganrogge January 8, 2026 17:38
@meganrogge
Copy link
Copy Markdown
Collaborator

Works!

Screenshot 2026-01-08 at 12 17 44 PM

@meganrogge meganrogge marked this pull request as ready for review January 8, 2026 18:17
Copilot AI review requested due to automatic review settings January 8, 2026 18:17
@meganrogge meganrogge requested a review from Tyriar January 8, 2026 18:18
@meganrogge meganrogge added this to the January 2026 milestone Jan 8, 2026
@meganrogge meganrogge enabled auto-merge (squash) January 8, 2026 18:18
Comment on lines 142 to 146
md += `score: ${item.score[0]}\n`;
md += `prefix: ${item.word ?? '(no prefix)'}\n`;
const vs = item.completion.replacementRange;
md += `valueSelection: ${vs ? `[${vs[0]}, ${vs[1]}]` : 'undefined'}\\n`;
md += `valueSelection: ${vs ? `[${vs[0]}, ${vs[1]}]` : 'undefined'}\n`;
md += `index: ${item.idx}\n`;
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.

Even better pattern would be lines: string[] and .join('\n')

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a formatting bug in the terminal suggest details widget's explain mode where the valueSelection field was displaying on the same line as the index field due to an escaped newline literal.

Key Change:

  • Fixed line 145 in simpleSuggestWidgetDetails.ts to use \n instead of \\n for proper newline rendering

@meganrogge meganrogge merged commit 831d16b into main Jan 8, 2026
27 of 28 checks passed
@meganrogge meganrogge deleted the copilot/fix-terminal-suggest-formatting branch January 8, 2026 19:07
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Feb 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

terminal suggest details widget has formatting issue

4 participants