You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue description:
It's possible I'm doing something very wrong, but when using an external code editor, introducing a class_name in GDScript appears to break the editor. The editor will crash when trying to play a scene with a script that references the named class. Disabling the external code editor or restarting the editor resolves the issue.
Steps to reproduce:
Open Godot and configure an external editor. I'm using VSCode with the godot-tools extension, version 1.1.2. The extension indicates that it is able to connect to Godot and completions and errors are (under normal circumstances) successfully shown.
Close Godot, reopen it, and create a new project.
Add a Node2D to the scene.
In the Scene view, click the Node2D and attach a new script. Name it Test.gd.
In the FileSystem view, right-click and select "New Script..." Accept all parameters and name it Util.gd.
Replace the contents of Util.gd with the following:
Replace the contents of Test.gd with the following:
extendsNode2Dfunc_ready():
Util.print_a_thing()
Save the current scene and attempt to play the project.
The editor will output the following:
Parser Error: The identifier "Util" isn't declared in the current scope.
Quit the editor and reopen the project, and attempt to play the scene. The editor will log "Hello!" to the console as expected.
Alternately, go to Editor > Editor Settings... > Text Editor > External and uncheck "Use External Editor". Open and resave the scripts, and play the scene. The editor will log "Hello!" to the console as expected.
Minimal reproduction project:
repro.zip Note that with the repro steps used above, reloading the editor appears to resolve the issue, so this repro project may not accurately demonstrate the issue.
Also note that unless I'm misunderstanding something, this appears to be a broader issue than #10946 -- this does not apply to a running game and occurs regardless of whether or not "Sync Script Changes" is checked.
So for some context in-case someone is interested.
The Godot Editor will do some magic that is not present in the Language Server that most external editors rely on. It will add files with class_name declarations to the _global_script_classes variable in the project.godot file.
It seems a possible fix would be to ensure that the didChange method of the GDScript Language server to call add_global_class found in godot/core/object/script_language.h
I'm still getting this issue with 3.3.2 even though #47891 has been merged to that branch. I even browsed the 3.3.2 commit to check if the fix is present, and it is. Doesn't seem like #47891 fixes this issue?
Godot version:
v3.2.3.stable.flathub
OS/device including version:
Linux x64
Issue description:
It's possible I'm doing something very wrong, but when using an external code editor, introducing a
class_name
in GDScript appears to break the editor. The editor will crash when trying to play a scene with a script that references the named class. Disabling the external code editor or restarting the editor resolves the issue.Steps to reproduce:
godot-tools
extension, version 1.1.2. The extension indicates that it is able to connect to Godot and completions and errors are (under normal circumstances) successfully shown.Minimal reproduction project:
repro.zip Note that with the repro steps used above, reloading the editor appears to resolve the issue, so this repro project may not accurately demonstrate the issue.
Also note that unless I'm misunderstanding something, this appears to be a broader issue than #10946 -- this does not apply to a running game and occurs regardless of whether or not "Sync Script Changes" is checked.
Possibly also related to #21461
The text was updated successfully, but these errors were encountered: