godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.48k stars 148 forks source link

Opening json files from godot editor will only open them in godot script editor, preventing saving of changes made in vscode #552

Closed DannyMichaud closed 7 months ago

DannyMichaud commented 7 months ago

Godot version

4.2.1

VS Code version

1.85.1

Godot Tools VS Code extension version

1.3.1

System information

Windows 11

Issue description

When trying to edit .json files in Godot 4.2 within vscode, I find sometimes that when I choose to "reload" the overwritten file after re-opening the godot editor, then launch the game afterwards, my changes made in vscode are overwritten.

After some investigation I found that this is because when you double click on a json file from within the godot editor, a copy is opened in both the godot script editor, but not vscode. The copy in the godot script editor overwrites any changes you attempted to made in vscode as soon as a save is triggered from the godot editor. Therefore, I was running into this issue because some of the .json files I was editing in vscode had been left open in the godot script editor without realizing.

I could 100% avoid this by exclusively using the vscode file explorer instead but whatever lol

Meanwhile, when double-clicking .gd files, a copy is opened in vscode but not the godot script editor. In my view this should be the default behavior for all text-based file types when using this plugin.

Unknown if this behavior applies to other file formats in GDScript.

Issue observed since Godot 4.2.

Steps to reproduce

  1. Double click on .json file in godot FileSystem, which opens file in godot script editor
  2. Open the file in vscode
  3. Try to make change in vscode, then save
  4. "Reload" the file when prompted in godot. Observe no change is made to the copy in the godot script editor.
  5. Try to save within godot, or run your game - the copy of the .json file in the godot script editor will overwrite what you changed in vscode
DaelonSuzuka commented 7 months ago

I don't see how this problem is related to the extension; it sounds like an engine bug. There's nothing I can do to modify any of the behavior you've mentioned.

I could 100% avoid this by exclusively using the vscode file explorer instead

Yes, you could.

DannyMichaud commented 7 months ago

yeah fair point, I outright forgot it was an editor setting that controlled this and not the plugin... sorry about that.