Skip to content

Conversation

@alexdima
Copy link
Member

Fixes microsoft/vscode#284225

Previously, switching documents could trigger NES even when NES hadn't been recently active, causing unexpected suggestions to appear. This change adds a check in _maybeTriggerOnDocumentSwitch to require that NES was triggered within the last 10 seconds before allowing a document switch to trigger a new NES request.

This aligns the document switch behavior with the existing same-document behavior, which already requires a recent NES trigger via the hasRecentTrigger check.

Fixes microsoft/vscode#284225

Previously, switching documents could trigger NES even when NES hadn't
been recently active, causing unexpected suggestions to appear. This
change adds a check in `_maybeTriggerOnDocumentSwitch` to require that
NES was triggered within the last 10 seconds before allowing a document
switch to trigger a new NES request.

This aligns the document switch behavior with the existing same-document
behavior, which already requires a recent NES trigger via the
`hasRecentTrigger` check.
Copilot AI review requested due to automatic review settings January 16, 2026 11:48
@alexdima alexdima enabled auto-merge January 16, 2026 11:48
@alexdima alexdima self-assigned this Jan 16, 2026
@alexdima alexdima requested a review from ulugbekna January 16, 2026 11:49
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 16, 2026
Copy link
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 an issue where Next Edit Suggestions (NES) could be unexpectedly triggered when switching documents even when NES hadn't been recently active. The change adds a check to require that NES was triggered within the last 10 seconds before allowing a document switch to trigger a new NES request.

Changes:

  • Added a lastTriggerTime check in _maybeTriggerOnDocumentSwitch to align document switch behavior with existing same-document behavior
  • Added comprehensive tests to verify NES is not triggered on document switch when there's no recent trigger, and is triggered when there is a recent trigger
  • Minor test infrastructure improvements (extracting triggerTextSelectionChangeWithKind helper and fixing createTextDocument to use passed parameters)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/extension/inlineEdits/vscode-node/inlineEditModel.ts Added lastTriggerTime check (lines 284-289) in _maybeTriggerOnDocumentSwitch to require recent NES activity before triggering on document switch
src/extension/inlineEdits/test/vscode-node/inlineEditModel.spec.ts Added two new tests covering document switch behavior with stale vs recent NES triggers, extracted helper function, and fixed test utility to properly use parameters

@alexdima alexdima removed the request for review from ulugbekna January 16, 2026 22:44
@alexdima
Copy link
Member Author

fyi @ulugbekna

@alexdima alexdima added this pull request to the merge queue Jan 16, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 16, 2026
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.

Don't show NES when making a selection

3 participants