Skip to content

Moving a file should load the model directly with the contents it had before #100255

@testforstephen

Description

@testforstephen

Version: 1.47.0-insider
Commit: 0288447
Date: 2020-06-15T05:32:43.514Z
Electron: 7.3.1
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.5.0

Currently when you move an unsaved file to a new location, VS Code will load the model with the disk content first, then do an extra update to append the unsaved changes to the model. See a typical workflow as below:

  • Open file A.java in VS Code.
  • Modify file A.java and add some contents, and leave it unsaved.
  • Drag and drop A.java to a new folder f1.
  • I observed the following notifications happening:
    -> didClose { uri: A.java }
    -> didOpen { uri: f1/A.java, version: 1, text: <the contents in the disk file> }
    -> didChange { uri: f1/A.java, version: 2, contentsChanges: <the unsaved changes before move> }

When there are extensions listening on renameFiles event for rename refactoring, the silent didChange behavior from VS Code client probably conflicts with the refactoring job. It makes more sense to load the model directly with the contents it had before.

Originally posted by @testforstephen in #98653 (comment)

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalityfile-ioFile I/Overification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions