godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.1k stars 21.15k forks source link

External Editor File Conflict Problem #84574

Open tamashii opened 11 months ago

tamashii commented 11 months ago

Godot version

v4.1.2.stable.mono.official [399c9dc39]

System information

Godot v4.1.2.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1050 (NVIDIA; 31.0.15.3623) - AMD Ryzen 5 3600X 6-Core Processor (12 Threads)

Issue description

There's a dialog shows up in Godot to asking about file confliction. I have checked this issue myself and confirmed that the dialog is causing by internal script editor, which is opened up the same script file when you click on error messages. And because that script file is changed by external editor, the internal editor detected changes and shows the file confliction dialog. Same issue can reproduce in v4.1.1 too, early versions not checked.

Steps to reproduce

  1. Configure external editor. For my situation I picked Visual Studio Code for external editor (with parameters {project} --goto {file}:{line}:{col}).
  2. Create a script file, where should contain codes to make syntax error, invoke undfeined functions or something similar.
  3. Load the script to any node, and run the game, there should be errors showing in the "Stack Follow" tab of "Debugger" panel.
  4. Click error to make it jump to external editor.
  5. Edit and save the error script in external editor and switch back to Godot Engine.

Minimal reproduction project

IssueReportDemo.zip A brief Godot project to cause error in Step.2.

KoBeWi commented 11 months ago

The dialog is expected to show. Enable text_editor/behavior/files/auto_reload_scripts_on_external_change editor setting to remove it.

Calinou commented 11 months ago

The editor could automatically reload externally modified files if no local unsaved changes were made (like in most modern IDEs), but this is proposal territory. I remember discussing this in a proposal but can't find it.

KoBeWi commented 11 months ago

This is the behavior with the setting I mentioned. It still asks for confirmation if you have unsaved changes. So the question is whether this should be enabled by default.

bitegw commented 11 months ago

This has been happening for a while to me as well. I wasn't using the internal editor at all, it just happens when you un-collapse an error to read it.

In my experience once this happens once, no matter what you do (like reload the script or discard changes) this dialog continues to appear again and again every time you play a scene until you restart the editor. It is incredibly obnoxious as there are no conflicts to resolve in the first place.

No changes are being made to the code using the internal editor in the first place, it just has an outdated file. Overwriting the file in the external editor should just silently refresh the debugger, and not harass users with a problem that doesn't exist.

IceflowRE commented 9 months ago

Does this error persist when enabling Debug with external editor?

IMHO this option should be automatically enabled when using an external editor. Because this has caused too many troubles (not only for me). Because if the option is disabled, the file is opened in two editors.

PadraigK commented 7 months ago

Does this error persist when enabling Debug with external editor?

IMHO this option should be automatically enabled when using an external editor. Because this has caused too many troubles (not only for me). Because if the option is disabled, the file is opened in two editors.

Thank you for mentioning this! I was searching for this option in Editor Settings but it's (weirdly imho!) in the Script editor's debug menu:

Screenshot of Debug with External Editor option