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

Rename class won't save the file #871

Closed
samba2 opened this issue Apr 9, 2019 · 6 comments
Closed

Rename class won't save the file #871

samba2 opened this issue Apr 9, 2019 · 6 comments

Comments

@samba2
Copy link

samba2 commented Apr 9, 2019

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.

Environment
  • Operating System: Windows 10
  • JDK version: jdk1.8.0_181
  • Visual Studio Code version: 1.33
  • Java extension version: 0.42.1
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

@yaohaizh
Copy link
Collaborator

yaohaizh commented Apr 9, 2019

Reproed this issue on the latest version.

@V-Klein
Copy link

V-Klein commented Apr 15, 2019

I can reproduce this issue.
Operating System: Windows_NT x64 10.0.17134
JDK version: openjdk version "11.0.2" 2019-01-15
Visual Studio Code version: 1.33.1
Java extension version: 0.42.1

@fbricon
Copy link
Collaborator

fbricon commented Apr 15, 2019

Indeed, this is new. Looks like a bug in vscode, since jdt.ls hasn't changed anything in that area in a long time.

@fbricon
Copy link
Collaborator

fbricon commented Apr 15, 2019

I've opened microsoft/vscode#72343 upstream

@fbricon
Copy link
Collaborator

fbricon commented Apr 25, 2019

The problem is fixed in VSCode. You can use the Insiders build until the next official release (1st week of May, probably)

@GabrielBB
Copy link
Contributor

Great. I'll wait for the next official release then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants