vscode: Imports are not updated if multiple files are moved

Issue Type: Bug

When multiple files are moved from one folder to another, the prompt to update imports is only triggered for one file.

Steps to repro:

  1. git clone https://github.com/9at8/vscode-update-import-test.git && cd vscode-update-import-test
  2. Click on src/modules/a.ts in the explorer
  3. Shift + click on src/modules/d.ts in the explorer
  4. Drag these 4 files to src/modules/test and accept moving them
  5. Only a.ts is prompted for updating imports

Expected:

  1. Imports are updated for all files

cc: @mjbvz

VS Code version: Code - Insiders 1.49.0-insider (8e872f41d4ba7807e58938bbf861ca6a22d534aa, 2020-08-20T08:51:16.154Z) OS version: Linux x64 5.8.0-2-MANJARO

System Info
Item Value
CPUs Intel® Core™ i7-7500U CPU @ 2.70GHz (4 x 2100)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: unavailable_off
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 2
Memory (System) 15.51GB (1.54GB free)
Process Argv –no-sandbox --crash-reporter-id 67c4af3b-3a6b-4a50-a37d-d89fa65036aa
Screen Reader no
VM 0%
DESKTOP_SESSION gnome
XDG_CURRENT_DESKTOP GNOME
XDG_SESSION_DESKTOP gnome
XDG_SESSION_TYPE wayland
Extensions (24)
Extension Author (truncated) Version
jest-snippets and 1.8.0
vscode-apollo apo 1.16.7
markdown-emoji bie 0.0.9
markdown-preview-github-styles bie 0.1.6
vscode-eslint dba 2.1.8
gitlens eam 10.2.2
EditorConfig Edi 0.15.1
prettier-vscode esb 5.1.3
vscode-lisp-formatter imj 1.1.3
vscode-docker ms- 1.5.0
remote-ssh ms- 0.51.0
remote-ssh-edit ms- 0.51.0
remote-wsl ms- 0.44.4
js-debug-nightly ms- 2020.8.1917
vscode-js-profile-flame ms- 0.0.7
vscode-markdown-notebook ms- 0.0.10
vsliveshare ms- 1.0.2666
vsliveshare-audio ms- 0.1.85
vsliveshare-pack ms- 0.4.0
debugger-for-chrome msj 4.12.10
fish-vscode sky 0.2.1
emacs-mcx tut 0.20.2
org-mode vsc 1.0.0
material-theme zhu 3.8.5

(1 theme extensions excluded)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 66
  • Comments: 23 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@9at8 It’s been a year so I guess I’ll ask again: How’s that rebase coming along?

This affects me so often, I wonder why so few people seem to be hitting this.

I can rebase the PR within the next week 😃

How’s that rebase coming along?

I’ve opened a PR to address this issue. If I am unable to get this PR approved, I’ll see if it’s possible to fix this issue via an extension.

This would be great to have implemented or maybe some warning / preventive action. I did end up thinking that around 30 files were updated after changing directory because the prompt did appear and I assumed it was for all files.

Even when a single file is moved, It’s not updating imports in all occurrences. Looks like it’s updating only the first occurrence it finds.

The PR was approved and the fix is now usable in the VSCode Insiders Build

Running into this all the time. As a workaround I (try to remember to) move files one at a time.

I can rebase the PR within the next week 😃

Please, help!! I’m moving 844 test files and everything seems to break every time I do so… Is it just me??

Edit: to tell you the truth, imports are not updated not even when when I move a single folder with just few files.

Yeah, it completely doesn’t work for folders. Sometimes, it works if you move an individual file, but if you do several files in a row, you have to wait for everything to update after each file is moved before moving onto the next file, or it will break. It’s almost worse than the feature not existing. I often wonder how something this broken ever made it into a production build.

I can’t wrap my head around how the maintainers of this can’t give it priority.

It’s because only 14 people have voted for this issue (as of this writing). If hardly anyone is bothered by a bug, the bug won’t get fixed. I don’t love that everything’s a popularity contest, but I guess there’s no better system 🤷‍♂️

image

Doing some file restructuring at work this week 😊 So giving this thread (and the devs!) some love ❤️

Still an issue with version 1.79.2. Project in Node.js (relative path for imports). While moving a file, the /tests folder is never updated rearding the imports.

Version: 1.79.2
Commit: 695af097c7bd098fbf017ce3ac85e09bbc5dda06
Date: 2023-06-14T08:59:55.818Z
Electron: 22.5.7
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Linux x64 5.19.0-45-generic

Please, help!! I’m moving 844 test files and everything seems to break every time I do so… Is it just me??

Edit: to tell you the truth, imports are not updated not even when when I move a single folder with just few files.

Just updated vscode hoping this fix would be int there but sadly bug still in VSCode as of June 23 2023 😦

This bug is absolutely ANNOYING and frustrating

I have to re-factor a, not even big, Angular codebase. As the team at the customer was totally new to Angular and made a lot of bad design choices. Now I have to manually go through all the .ts files and check if the imports are right. Because this broken piece of software can’t even properly display where there are errors, if you don’t open every file manually. What a disaster.

I mean, how the fu* is it possible that this editor, which is claimed to be the most versatile IDE, doesn’t even get basic sh* like that right???

Sorry for the language. But I’m forced to use it for UI work at my current project, as I won’t get IntelliJ Ultimate installed by the admins on my assigned dev VM, or any other software better than this as I won’t get root or sudo. Yeah, that’s a whole different story. But it doesn’t change the fact that this is such basic functionality for an IDE that I can’t wrap my head around how the maintainers of this can’t give it priority. It’s so infuriating. Maybe it’s user error,idk,I couldn’t find anything helpful yet. But if it is, this should work out of the box and no thought needed. As it is, a very basic feature. Maybe not simple,but basic.