Skip to content

Comments

Fix detected attachment sticking around after editor is closed#297400

Merged
daviddossett merged 1 commit intomainfrom
daviddossett/fix-implicit-context-stale-attachment
Feb 24, 2026
Merged

Fix detected attachment sticking around after editor is closed#297400
daviddossett merged 1 commit intomainfrom
daviddossett/fix-implicit-context-stale-attachment

Conversation

@daviddossett
Copy link
Collaborator

Fixes #297284

When all editors are closed, the implicit context (detected attachment) should be cleared. Previously, the guard condition in updateImplicitContext preserved stale values because newValue was undefined and hasValue was true — both sides of the OR were false, so setValues was never called.

Now we also check whether there's any active editor. If there's no active editor at all (all editors closed), the values are cleared instead of preserved. The preserve behavior still applies when a non-code editor (e.g. Settings) is active.

When all editors are closed, the implicit context should be cleared.
Previously, the guard condition preserved stale values because
`newValue` was undefined and `hasValue` was true. Now we also check
`hasActiveEditor` — if there's no active editor at all, values are
cleared instead of preserved.
Copilot AI review requested due to automatic review settings February 24, 2026 17:14
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 a bug where the chat implicit context (detected attachment) incorrectly persists after all editors are closed. The issue stemmed from the guard condition in updateImplicitContext preserving stale values when both newValue was undefined and hasValue was true.

Changes:

  • Modified the implicit context update logic to check if there's any active editor at all, clearing values when no editors are open while still preserving them for non-code editors like Settings

@daviddossett daviddossett marked this pull request as ready for review February 24, 2026 17:29
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 24, 2026
@daviddossett daviddossett merged commit addd8a9 into main Feb 24, 2026
24 checks passed
@daviddossett daviddossett deleted the daviddossett/fix-implicit-context-stale-attachment branch February 24, 2026 19:44
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.

Chat input: Detected attachment sticks around even after editor is closed

2 participants