vscode: Dangling text file models of deleted files hanging around in memory

  • VSCode Version: 1.45.1
  • OS Version: Windows 10

Steps to Reproduce: Screencast: dnd1

  1. Open sample node project below in VS Code. dnd.zip
  2. Set the setting “typescript.updateImportsOnFileMove.enabled”: “always” or “never”.
  3. Click to open multiple files (e.g. src/utils/ma.ts, src/utils/mb.ts, src/utils/mc.ts, src/utils/md.ts) in VS Code.
  4. In File Explorer, drag and drop these files back and forth several times, e.g.
1st dnd:  utils/m*.ts -> funcs/m*.ts
2st dnd:  funcs/m*.ts -> utils/m*.ts
3rd dnd:  utils/m*.ts -> funcs/m*.ts
  1. You would see the states for these opened editors are in chaos. Some showed as “deleted”, see the screenshot below. But actually these files exist. My initial finding was that vscode didn’t clear the opened text models for the old locations after the move operation, so that the next time you move back, vscode will try to reuse the previously cached text models. image

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

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (15 by maintainers)

Commits related to this issue

Most upvoted comments

A little difference is that we provide the option for users to preview the update.

FYI - our current plan is to add API, e.g a workspace edit can say that it can be previewed and based on user-preference the preview pane will show. Similar to how rename (symbol) preview works