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

Discarding unsaved changes doesn't actually discard unsaved changes #40199

Closed
danielzting opened this issue Jul 8, 2020 · 4 comments · Fixed by #82847
Closed

Discarding unsaved changes doesn't actually discard unsaved changes #40199

danielzting opened this issue Jul 8, 2020 · 4 comments · Fixed by #82847

Comments

@danielzting
Copy link
Contributor

Godot version:

v3.2.2.stable.official

OS/device including version:

macOS Catalina 10.15.5 (19F101)
MacbookAir8,1

Issue description:

If you try to close an unsaved script and discard its changes, the changes are in fact not saved to disk. However, opening the script the next time will bring back the changes. In addition, the output console shows the following errors:

 core/io/config_file.cpp:296 - ConfigFile parse error at /Users/danielting/Library/Application Support/Godot/projects/human-computer-simulator-e3ec1ec4e8437580903c6b50e04cac9d/project_metadata.cfg:14: Unexpected identifier: 'PackedColorArray'..
 core/io/config_file.cpp:296 - ConfigFile parse error at /Users/danielting/Library/Application Support/Godot/projects/human-computer-simulator-e3ec1ec4e8437580903c6b50e04cac9d/project_metadata.cfg:14: Unexpected identifier: 'PackedColorArray'..
 core/io/config_file.cpp:296 - ConfigFile parse error at /Users/danielting/Library/Application Support/Godot/projects/human-computer-simulator-e3ec1ec4e8437580903c6b50e04cac9d/project_metadata.cfg:14: Unexpected identifier: 'PackedColorArray'..
 Cannot load editor settings from file '/Users/danielting/Library/Application Support/Godot/projects/human-computer-simulator-e3ec1ec4e8437580903c6b50e04cac9d/project_metadata.cfg'.

However x2, this only happens if the changes are syntactically correct.
Note: running the project seems to always load whatever is actually on disk.

Steps to reproduce:

  1. Open any script
  2. Add something like print(0) anywhere
  3. Click File -> Close and choose Discard
  4. Verify outside the editor that the changes have seemingly been discarded, but...
  5. Open the file again, the changes are still there?
  6. Change print(0) to something with invalid syntax like print(0*)
  7. Close and reopen file, this time the changes got discarded??

It seems like Godot is checking the syntax and if it is correct, it stores the file contents in some sort of cache. Otherwise, it reverts back to the last syntactically correct edit. You can check this behavior by first copy-pasting print(0*) and reopening; the whole line will be removed. But if you first type print(0) and then add the asterisk, only the asterisk will get removed.

@KoBeWi
Copy link
Member

KoBeWi commented Mar 6, 2021

I can confirm this in 3.2.4 rc3 and a4b5edf
The error doesn't appear though.

@Calinou

This comment was marked as outdated.

@KoBeWi
Copy link
Member

KoBeWi commented Feb 20, 2023

This was not a duplicate.

@KoBeWi KoBeWi reopened this Feb 20, 2023
@KoBeWi KoBeWi removed the archived label Feb 20, 2023
@Naros
Copy link
Contributor

Naros commented Oct 5, 2023

I can also reproduce this against 4.2.dev5.

When a script is modified and closed, selecting the discard option, the contents in the script cache are not actually discarded. Any action you take while the editor remains open loads the script contents from cache rather than disk. The only way to have the editor load the contents as they're on disk is to reload the project.

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

Successfully merging a pull request may close this issue.

6 participants