-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Fix external editor hot reload for GDScript #82986
Fix external editor hot reload for GDScript #82986
Conversation
I am currently using Jetbrains Rider & C#. The issue I experience is that If I have a Node open in the editor with a C# script attached. Make a change in Rider to the script & save. Then make a change to an export variable in the inspector and then save. The behaviour is that the script reverts and Rider does a hot reload and I lose my changes. I have compiled this particular PR and I am able replicate the bug in it. Is this PR catering for my scenario or is my issue different? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@pchan3 This PR only changes things for the GDScript LSP, not for C# editors. |
Should I raise this as a new bug? |
Thanks! |
is this already in the latest beta @OmarShehata , how do I try it? |
Fixes #72825 by adding a call to:
in the
GDScriptTextDocument::didSave
callback. I tested this using the VSCode Godot extension, when connected to the language server, inmaster
saving the file in VSCode does NOT trigger an update. An update only happens when you focus in the editor, which goes through the flow:ScriptEditor::_notification
->_update_modified_scripts_for_external_editor()
.https://github.com/godotengine/godot/blob/6916349697a4339216469e9bf5899b983d78db07/editor/plugins/script_editor_plugin.cpp#L1677C4-L1677C48
For reference, the normal flow of updating a script file while the game is running goes through
ScriptEditor::_res_saved_callback()
->_trigger_live_script_reload()