Skip to content

Duplicate imports when using "Update Imports On Paste" #257963

@ido-pluto

Description

@ido-pluto

Does this issue occur when all extensions are disabled?: Yes

Version: 1.103.0-insider (Universal)
Commit: d8361fe
Date: 2025-07-25T05:03:31.984Z
Electron: 37.2.3
ElectronBuildId: 11993778
Chromium: 138.0.7204.100
Node.js: 22.17.0
V8: 13.8.500258-electron.0
OS: Darwin arm64 24.5.0

(Happens both in insider and in latest stable version)

About the issue

  • When you copy code that relay on symbols that already exits in the target file - you will have duplicate imports.
  • When you copy code to a comment it will also copy the imports.

Steps to Reproduce

Copy code that relay on import to another file that already has this import.

video.mp4

Check out this repo for easy reproduce:
https://github.com/ido-pluto/vscode-copy-with-import-issue/tree/main

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions