Repository: godotengine/godot (language: cpp)

Issue:
"The following files are newer on disk" constant pop-up
### Tested versions

- Reproducible in Godot 4.4 Beta 3
- Not reproducible in Godot 4.3 Stable

![Image](https://github.com/user-attachments/assets/60d7655b-fd54-47d5-9a34-8191987454d3)

### System information

Windows 11 - Godot v4.4.beta3.official [06acfccf8] - RTX 3060

### Issue description

This constantly keeps popping up in version 4.4 Beta 3. This was not an issue in 4.3. The file its referencing isn't being moved or even touched at all, but this message will continuously come up every few minutes or when switching scenes. All 3 buttons make no difference. I've tried getting rid of the UID to see if that had something to do with it, I've remade the entire file once already and that fixed it for a bit but it came back a few days later. 

Github does not see any changes happening with this file either so I know its not being moved by something external.

### Steps to reproduce

I'm not really sure how this started happening. It originally happened with 2 different files that had nothing to do with each other but the 2nd one went away after remaking it, but not with the one in the screenshot.

### Minimal reproduction project (MRP)

Projects too far developed to do this


Discussion / hints:
Actually I have this happen often on  Godot 4.3 Stable as well when using Rider for example. Whenever I move back it keeps asking me this. closing Godot usually fixes it for a while, but when it starts happening it's until I reopen it again.
See:
* https://github.com/godotengine/godot/issues/102234

Please try deleting your `.godot` folder
The popup will appear for scripts when they are opened in Script Editor and there are external changes. You can enable `text_editor/behavior/files/auto_reload_scripts_on_external_change` to skip it.
> The popup will appear for scripts when they are opened in Script Editor and there are external changes. You can enable `text_editor/behavior/files/auto_reload_scripts_on_external_change` to skip it.

So should the "auto reload scripts on external change" now be used even when using external editor through language server? 
You need it only if you have scripts open both in Godot and in external editor. The dialog should not appear otherwise.
> You need it only if you have scripts open both in Godot and in external editor. The dialog should not appear otherwise.

I think Godot auto opens them sometimes when there's an error, we press the link on editor (and opening the external), that's usually when I start having issues. 
If there's an external it should never open it on "Editor" tab, but sometimes I See them open and have to re-close all, so that might be an indication of the issue
> You need it only if you have scripts open both in Godot and in external editor. The dialog should not appear otherwise.

But why the dialog even appears when the script file is already reloaded through the language server? I can see that the changes made in vscode appear in Godot's script editor just like reported in https://github.com/godotengine/godot/issues/102234
That sounds like a bug. The dialog should appear without the script being reloaded yet (in the editor at least).
I can confirm this. if I write any shader and save it then run the project every time I quit the game the dialog apear even if I don't change anything internals or external. 
I can reproduce a bug when the file is changed externally. Can't reproduce bugs without external changes.

Fix patch:
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 8461d837e693..af7812abe806 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -2843,10 +2843,13 @@ void ScriptEditor::_reload_scripts(bool p_refresh_only) {
 		Ref<Resource> edited_res = se->get_edited_resource();
 
 		if (edited_res->is_built_in()) {
-			continue; //internal script, who cares
+			continue; // Internal script, who cares.
 		}
 
-		if (!p_refresh_only) {
+		if (p_refresh_only) {
+			// Make sure the modified time is correct.
+			se->edited_file_data.last_modified_time = FileAccess::get_modified_time(edited_res->get_path());
+		} else {
 			uint64_t last_date = se->edited_file_data.last_modified_time;
 			uint64_t date = FileAccess::get_modified_time(edited_res->get_path());
 


Test patch: