Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to save file after renaming occurred #72343

Closed
fbricon opened this issue Apr 15, 2019 · 8 comments
Closed

Failure to save file after renaming occurred #72343

fbricon opened this issue Apr 15, 2019 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug file-io File I/O verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@fbricon
Copy link
Contributor

fbricon commented Apr 15, 2019

This issue was initially reported as redhat-developer/vscode-java#871

  • Operating System: Windows 10, macOS 10.14.3
  • JDK version: jdk1.8.0_181
  • Visual Studio Code version: 1.33.1
  • Java extension version: 0.42.1

Steps to Reproduce:

When renaming a class (F2) the class symbol and the file itself are renamed properly. However, when I try to save the file the following error is displayed:

Failed to save 'NewName.java': The content on disk is newer. Please compare your version with the one on disk.

When I now click on the compare button (part of the error popup) and accept the change then the renamed class is eventually saved.

Steps To Reproduce
  1. create new file MyClass.java
  2. inside MyClass.java expand the template"class" which gives you a skeleton for MyClass
  3. position the cursor inside the symbol MyClass
  4. press F2 (rename)
  5. enter NewName
  6. the mentioned error popup is displayed
  7. press Compare
  8. accept new version
  9. NewName.java is saved
Current Result

Extra step to save/ accept the renamed class.

Expected Result

After changing the name of the class via F2, the class symbol as well as the file name are changed and saved.

Additional Informations

When autosave is turned on the error occurs instantly, with autosave turned off the error popup is displayed when saving manually.

vs-code-rename-error

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

I checked the problem doesn't occur with VS Code 1.32.3, so the regression was introduced in 1.33

@jrieken
Copy link
Member

jrieken commented Apr 15, 2019

@bpasero for changes in the file service

@bpasero bpasero added the bug Issue identified by VS Code Team member as probable bug label Apr 16, 2019
@bpasero bpasero added this to the April 2019 milestone Apr 16, 2019
@bpasero
Copy link
Member

bpasero commented Apr 16, 2019

I think I am seeing this with typescript too.

@bpasero bpasero added the file-io File I/O label Apr 16, 2019
@bpasero
Copy link
Member

bpasero commented Apr 17, 2019

@fbricon can I ask you to please try to reproduce this from our latest insider version: You can give our preview releases a try from: https://code.visualstudio.com/insiders/

If it reproduces: is that class you are renaming used anywhere outside? Could you give me a minimal repository to reproduce that I can clone?

@bpasero bpasero added the info-needed Issue requires more information from poster label Apr 17, 2019
@fbricon
Copy link
Contributor Author

fbricon commented Apr 17, 2019

I can reproduce with Insiders 1.34 (6d5feae 2019-04-17T09:11:24.577Z).
To reproduce:

  • unzip rename-me.zip,
  • open the rename-me folder in vscode
  • open foo/bar/RenameMe.java,
  • wait for the thumb up icon on the lower right to show up, indicating the Java language server is started,
  • rename the RenameMe class to whatever you want, once done, save the file

@bpasero
Copy link
Member

bpasero commented Apr 17, 2019

@fbricon thanks, I see it.

@bpasero bpasero added verification-needed Verification of issue is requested and removed info-needed Issue requires more information from poster labels Apr 18, 2019
@bpasero
Copy link
Member

bpasero commented Apr 18, 2019

@fbricon pushed a fix, it would be great if you could verify it from an insiders build starting today or later.

@fbricon
Copy link
Contributor Author

fbricon commented Apr 25, 2019

I confirm the problem is fixed in the Insiders build

@bpasero bpasero added the verified Verification succeeded label Apr 26, 2019
@bpasero
Copy link
Member

bpasero commented Apr 26, 2019

@fbricon thank you

@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug file-io File I/O verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants