godotengine / godot

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

Property randomly replaced when using external editor (VSCode) #90114

Open Kieirra opened 3 months ago

Kieirra commented 3 months ago

Tested versions

4.2.1

System information

Windows 10

Issue description

I'm running into a repeating problem in Godot when I use VSCode as my editor.

Here's what happens: I rename some properties in my script using VSCode. Then, if I save my work in Godot after adding something like a new node, the names of these properties switch back to what they were before. If I save again in VSCode, the names go back to the new ones.

This back-and-forth can keep happening, and I end up having to use Godot's built-in editor to stop it from continuing.

image

Steps to reproduce

  1. Set up VSCode as the external editor in the Godot settings.
  2. Install the Godot Tools extension in VSCode and connect it with your Godot project.
  3. Create a new script in Godot and attach it to any node in your scene.
  4. In VSCode, add a new property to the script.
  5. Save the changes in VSCode and observe the property update correctly in the Godot Editor.
  6. Rename this newly added property directly in VSCode.
  7. Save the changes in VSCode and observe the property update correctly in the Godot Editor.
  8. Without making further changes, save the project again in Godot Editor.
  9. Observe that the property name sometimes unexpectedly reverts to its original name. This issue occurs randomly but with sufficient frequency to cause significant frustration.

Minimal reproduction project (MRP)

N/A

azuloo commented 2 months ago

I've managed to reproduce this issue but the behavior on my side is somewhat different. I suspect It might be a localization issue. What language are you using in Godot Editor?

Kieirra commented 2 months ago

Thank you for taking the time to respond.

I am using the French language in Godot. image

I'll switch the setting to 'en' and test if that resolves the issue. If it does, that would be a really great catch.

Kieirra commented 2 months ago

I haven't encountered the issue again when using the English ('en') language setting for the past two days. I will continue to monitor the situation over the coming week to confirm if this resolves the problem.

Kieirra commented 2 months ago

I'm not sure if it's directly related, as I couldn't reproduce the exact same bug with renaming (and this issue has become less frequent since I switched to English language settings).

However, I encountered a similar issue when adding a property (the poi_scn property). Here's a video that illustrates the problem: https://github.com/godotengine/godot/assets/43383107/5609183d-51f7-4138-883a-30e7d457a46a

I continuously switch between saving in Godot and VSCode in the video. It appears that Godot is having trouble sometimes loading the real file from the disk.

azuloo commented 2 months ago

I don't see the same problem you've described earlier in the video you've provided. Is it something about that Godot is not loading poi_scn property when you're saving your project in the editor?

Kieirra commented 2 months ago

In the video, I perform the following actions:

  1. Save in VS Code → Property poi_scn appears in Godot
  2. Save in Godot → Property poi_scn disappears
  3. Save in VS Code → Property poi_scn appears again
  4. Save in Godot → Property poi_scn disappears again etc.

The behavior was the same when renaming the variables in my first post.

azuloo commented 2 months ago

I remember I've had a similar issue when I was setting up external (VSCode) editor to reproduce the initial bug (naming) but it vanished abruptly. Right now I cannot reproduce it. Do you have 100% repro rate with the steps you've provided?

Kieirra commented 2 months ago

Do you have 100% repro rate with the steps you've provided?

No but it occurs more often when I modify code while Godot Scene Player is still running. Afterward, even if I stop Godot, the problem continues to appear.

saierXP commented 1 month ago