Skip to content

nes: fix: do not insert spurious trailing newline after suggestion#311441

Merged
ulugbekna merged 3 commits intomainfrom
ulugbekna/global-camel
Apr 20, 2026
Merged

nes: fix: do not insert spurious trailing newline after suggestion#311441
ulugbekna merged 3 commits intomainfrom
ulugbekna/global-camel

Conversation

@ulugbekna
Copy link
Copy Markdown
Contributor

No description provided.

ulugbekna and others added 2 commits April 20, 2026 20:32
… the suggestion

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 20, 2026 18:33
@ulugbekna ulugbekna enabled auto-merge (rebase) April 20, 2026 18:33
@ulugbekna ulugbekna self-assigned this Apr 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 3aeae51b Current: 377bf2b2

Changed (1)

chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
Before After
before after

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 adjusts NES inline suggestion conversion for the “insert on next line” case to avoid introducing an extra trailing newline (which can render as a spurious blank line when shown/applied as ghost text).

Changes:

  • Trim a single trailing newline from newText when massaging a next-line insertion into a cursor-line pure insertion.
  • Update existing unit tests to reflect the trimmed trailing newline behavior.
  • Add a regression test covering insertion into an object literal scenario.
Show a summary per file
File Description
extensions/copilot/src/extension/inlineEdits/vscode-node/isInlineSuggestion.ts Trims a trailing linefeed when converting next-line insertions into cursor insertions for inline suggestions.
extensions/copilot/src/extension/inlineEdits/test/vscode-node/isInlineSuggestion.spec.ts Updates expectations and adds a regression test for the new trimming behavior.

Copilot's findings

Comments suppressed due to low confidence (1)

extensions/copilot/src/extension/inlineEdits/test/vscode-node/isInlineSuggestion.spec.ts:154

  • Same issue as above: replace(/\n$/, '') isn't CRLF-safe and can leave a trailing \r. Prefer stripping \r?\n so the test matches expected behavior across EOL styles.
		assert.strictEqual(result!.newText, '\n' + replaceText.replace(/\n$/, ''));
  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment thread extensions/copilot/src/extension/inlineEdits/vscode-node/isInlineSuggestion.ts Outdated
Co-authored-by: Copilot <copilot@github.com>
@ulugbekna ulugbekna added the release-cherry-pick Automated cherry-pick between release and main branches label Apr 20, 2026
@ulugbekna ulugbekna closed this Apr 20, 2026
auto-merge was automatically disabled April 20, 2026 19:10

Pull request was closed

@ulugbekna ulugbekna reopened this Apr 20, 2026
@ulugbekna ulugbekna enabled auto-merge (squash) April 20, 2026 19:10
@ulugbekna ulugbekna merged commit 11d49ab into main Apr 20, 2026
41 of 49 checks passed
@ulugbekna ulugbekna deleted the ulugbekna/global-camel branch April 20, 2026 19:31
@vs-code-engineering vs-code-engineering Bot added this to the 1.116.0 milestone Apr 20, 2026
ulugbekna added a commit that referenced this pull request Apr 20, 2026
…311441)

* nes: show how insertion at cursor leaves an unnecessary newline after the suggestion

Co-authored-by: Copilot <copilot@github.com>

* nes: fix: do not insert spurious trailing newline after suggestion

Co-authored-by: Copilot <copilot@github.com>

* account for CRLF

Co-authored-by: Copilot <copilot@github.com>

---------

Co-authored-by: Copilot <copilot@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-cherry-pick Automated cherry-pick between release and main branches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants