godot
godot copied to clipboard
GDScript doesn't recognize some newly added members until editor restart
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
- Open the MRP.
- Open ScriptB
- Uncomment InternalClass2.
- Go to ScriptA.
- Change InternalClass to InternalClass2.
- Error
- Restart editor
- No error
Minimal reproduction project
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
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 I've had this issue in multiple versions since 4.0 dropped so I dont think its anything to do with a specific version.
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.
Have any of you been able to work around this by using VS Code instead of scripting in the engine?
@Luke9389 VSCode uses the language server so would have (and in my experience, does have) the same issues
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.
Seems likely the same as or at least similar to https://github.com/godotengine/godot/issues/70841