Skip to content

Fix terminal-editor shift-drop on detached instances - #335945

Open
Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
mainfrom
agents/fix-terminal-editor-shift-drop-bug
Open

Fix terminal-editor shift-drop on detached instances#335945
Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
mainfrom
agents/fix-terminal-editor-shift-drop-bug

Conversation

@dmitrivMS

@dmitrivMS Dmitriy Vasyura (dmitrivMS) commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator
  • dispose terminal drag-and-drop observers when their instances detach from an editor container
  • prevent deferred drag-and-drop initialization from attaching to a stale container
  • add regression coverage for initialized and pending observers during terminal editor tab reuse

Fixes #311164

Co-authored-by: Vlad Gerasimov vlad@vlad.studio

Dispose the drag-and-drop observer when a terminal detaches and prevent deferred initialization from targeting a stale container. Add regression coverage for both initialized and pending observers during terminal editor tab reuse.

Fixes #311164

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 12, 2026 08:42
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added workbench-dnd Drag-and-drop issues terminal General terminal issues that don't fall under another label labels Sep 12, 2026

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.

Copilot review overview

🟢 Approval recommended

The lifecycle fix is narrowly scoped and both relevant race conditions have regression coverage.

Review tier: Balanced
Findings: None

What changed in this PR

Fixes terminal editor drag-and-drop observers persisting after tab reuse.

Changes:

  • Dispose drag-and-drop observers when detaching terminals.
  • Guard deferred initialization against stale containers.
  • Add regression tests for initialized and pending observers.
File Description
terminalInstance.ts Corrects drag-and-drop observer lifecycle.
terminalInstance.test.ts Covers detach and deferred-initialization scenarios.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: a8f49160 Current: bcdb178f

Changed (2)

imageCarousel/imageCarousel/SingleSectionMiddleImage/Dark
Before After
before after
imageCarousel/imageCarousel/SingleSectionMiddleImage/Light
Before After
before after

2 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details.

@Ultron09

Copy link
Copy Markdown

Thanks Dmitriy Vasyura (@dmitrivMS) for adding the expanded end-to-end regression tests and carrying the fix forward from #332908!

Could you please include:
Co-authored-by: Ultron09 <connect.singha@gmail.com>
in the commit/squash message so contributor attribution is preserved upon merge? Thank you!

@dmitrivMS

Copy link
Copy Markdown
Collaborator Author

Thanks Dmitriy Vasyura (Dmitriy Vasyura (@dmitrivMS)) for adding the expanded end-to-end regression tests and carrying the fix forward from #332908!

Could you please include: Co-authored-by: Ultron09 <connect.singha@gmail.com> in the commit/squash message so contributor attribution is preserved upon merge? Thank you!

Hmm... I didn't use your PR at all. I can add Co-authored-by: Vlad Gerasimov vlad@vlad.studio

@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Anthony Kim (@anthonykim1)

Matched files:

  • src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
  • src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts

@Ultron09

Copy link
Copy Markdown

Hi Dmitriy Vasyura (@dmitrivMS) — no worries at all! Just to clarify, the production fix in src/vs/workbench/contrib/terminal/browser/terminalInstance.ts (this._dndObserver.clear() in detachFromElement and the this._container !== container guard in attachToElement) was from PR #332908 which you approved earlier today before opening this PR to add the real instance drop tests.

Crediting Vlad as well for the earlier iteration in #318756 is great! Either way, really glad to see #311164 resolved. Thanks for shepherding it to completion!

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

Labels

terminal General terminal issues that don't fall under another label workbench-dnd Drag-and-drop issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dragging a file into one terminal editor while holding Shift inserts the path into other terminal editors as well

4 participants