godot icon indicating copy to clipboard operation
godot copied to clipboard

GDScript doesn't recognize some newly added members until editor restart

Open KoBeWi opened this issue 1 year ago • 7 comments

Godot version

4.0.2

System information

Windows 10 x64

Issue description

I have a ScriptB with InternalClass and a ScriptA which has a method that returns InternalClass. If I add an InternalClass2 and change the method to return it, I get an error that the class does not exist. It requires editor restart to fix the error.

The error is also slightly different, depending on whether I use the class as return type or as return value:

https://user-images.githubusercontent.com/2223172/233865401-1e79abfd-823c-441f-9da5-52895fbeaa06.mp4

Steps to reproduce

  1. Open the MRP.
  2. Open ScriptB
  3. Uncomment InternalClass2.
  4. Go to ScriptA.
  5. Change InternalClass to InternalClass2.
  6. Error
  7. Restart editor
  8. No error

Minimal reproduction project

gdbug.zip

KoBeWi avatar Apr 23 '23 20:04 KoBeWi

Surprised to see that this bug has remained open for almost a full year now - curious as to the current priority status? As it stands, this frequently leads to a lot of misleading errors while I'm editing my game's code, and the only workaround is to manually reload the whole project after implementing a feature to get accurate messaging. Would really love to see a resolution to this as it makes editing multiple GDscript files extremely cumbersome

NickMakesGames avatar Apr 14 '24 02:04 NickMakesGames

This issue has been plaguing a project now for multiple weeks. Is there any way to add attention/urgency to this?

Also I noticed the version info above says 4.0.2, but the closed issue marked as a dupe has this on 4.2.1 (which is also where I'm experiencing it).

Luke9389 avatar Apr 22 '24 20:04 Luke9389

@Luke9389 I've had this issue in multiple versions since 4.0 dropped so I dont think its anything to do with a specific version.

Rustywolf avatar Apr 23 '24 09:04 Rustywolf

Issues are always assumed to be relevant in the newest available version, unless they have 3.x milestone. I'm still encountering this one in 4.3.

KoBeWi avatar Apr 23 '24 10:04 KoBeWi

Have any of you been able to work around this by using VS Code instead of scripting in the engine?

Luke9389 avatar Apr 24 '24 00:04 Luke9389

@Luke9389 VSCode uses the language server so would have (and in my experience, does have) the same issues

Rustywolf avatar Apr 24 '24 02:04 Rustywolf

One thing I find strange is that I can open a brand new project, attempt to replicate this behavior, and it's totally fine. This caused me to wonder if perhaps it was a gdLint problem, or something within godot-gdscript-toolkit.

Luke9389 avatar Apr 24 '24 17:04 Luke9389

Seems likely the same as or at least similar to https://github.com/godotengine/godot/issues/70841

Kylemcarthur avatar Jun 26 '24 03:06 Kylemcarthur