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

Script editor fails to reload closed scripts after externally modified #100945

Open
dog-on-moon opened this issue Dec 30, 2024 · 3 comments
Open

Comments

@dog-on-moon
Copy link
Contributor

dog-on-moon commented Dec 30, 2024

Tested versions

  • Reproducible in v4.4.dev7.official [46c8f8c]

System information

Godot v4.4.dev7 - Windows 11 (build 22631) - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 32.0.15.6603) - Intel(R) Core(TM) i7-10700F CPU @ 2.90GHz (16 threads)

Issue description

When a script is edited externally, it correctly reloads in the script editor if the script is open. Otherwise, the edit appears to be undetected, and the wrong script is displayed.

This greatly affects teams where script changes are frequently pulled, where an editor restart is currently required after every pull ( not good ), but can be tested manually with two editor processes running, or by editing a script externally.

The scripts are only out of date within the editor itself. Running the project will use the updated changes, even when its script editor conflicts with what is expected.

Video demonstration (using two editors):

Godot_v4.4-dev7_win64_Icj1F8LseJ.mp4

Steps to reproduce

  1. Run the editor, and leave a script closed.
  2. Edit that script externally by any means.
  3. Focus the editor, and it will not pick up the script changes.

Minimal reproduction project (MRP)

N/A

@RealMadvicius
Copy link
Contributor

Let me know if I have correctly understood the issue.

If you have a script opened in the script editor and that you edit it externaly with for example Notepad++, the editor detects a change of the file and will prompt you about it and reload the file.

If you have a script that isnt opened in the editor BUT you externaly edit, you wont have any notification of change made to the file that wasnt opened in the editor.

So in the second case mentioned, if you then open the script in the godot editor after editing it externaly, is it containing the updated content or does it look like a older cached version of the file ?

@dog-on-moon
Copy link
Contributor Author

An older cached version of the file is indeed used.

@RealMadvicius
Copy link
Contributor

So the issue seems that:

  • the editor deploys listenners for file changes only for opened files ( most likely to save on performance and resources )
  • the editor "preload" all scripts into a cache at project load moment and after that only work into a diff / incremental way to detect live changes

I can think of these possible solutions:

  • have listenners always created and listenning for any changes done to any dependencies of the project and reload any changed ones ( scripts, resources, addons, etc... ) => extremely accurate monitoring of changes but in same time very aggressive on system resources usage
  • have the editor to always reload from storage instead of cache => solve the issue of continuous resource usage but can have a big impact on big projects with massive files which would take ages to load , imagine for example changing one file that is a dependency of another set of massive files, it would mean potentialy that we have to reload not only the changed one but also the others
  • maybe base the detection and need for a reload against a checksum, if a loaded file of the project ( but not opened ) checksum is different from the checksum of the file on the storage drive then compute which set of files have to be reloaded including this one too

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

3 participants