didier-v / GDBeautifier

A GDScript beautifier plugin for Godot
Apache License 2.0
13 stars 3 forks source link

Beautify should use the unsaved version of the script. #7

Open wyattbiker opened 1 month ago

wyattbiker commented 1 month ago

If make a change to a script (e.g. add a comment) and run beautify without first saving, it undoes the changes; unless I move away to another script and back. Obviously Godot is saving it in a temporary area when you move away then back.

didier-v commented 1 month ago

Yes, I chose to not auto save the script after modifying it. I don't know, may be it was a bad idea. I'll think about it.

wyattbiker commented 1 month ago

I would not want autosave. Its an issue with reading the editor buffer after being edited. I think its a bug in Godot it does not update the buffer unless you move to amother script and then back.

As a matter of fact I had opened a bug a while back on github about this. It's still open. I could not find a workaround, other than maybe saving it to a temp file, but would be a kludge fix. However I would not want the plugin to save it to the actual file. Let the user do that.

https://github.com/godotengine/godot/issues/65450