-
-
Notifications
You must be signed in to change notification settings - Fork 22k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GDScript: Don't highlight unexposed classes #98169
GDScript: Don't highlight unexposed classes #98169
Conversation
I'm not sure this makes sense. Yes, the user can't use unexposed classes, but the user also can't define a custom class with that name, so in my opinion it makes sense to highlight it. Maybe a different color, though that's probably overkill. |
Using those names as |
Now I wonder why it works with |
Nevermind, this is a bug in my test project. To some extent, it should work, because we have the following check: godot/modules/gdscript/gdscript_analyzer.cpp Lines 6216 to 6218 in 92e51fc
But still, naming a class or other identifier as a native class (whether it's exposed or not) is a bad idea, the user risks encountering strange bugs, since scopes and shadowing are not implemented very well. |
To be honest I'd just emit a warning if a user is doing that, and keep it out of the highlighting. Users won't understand the implication behind it just from highlighting, and if there is a warning I don't feel an extra highlight color would add much value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I'd just emit a warning if a user is doing that, and keep it out of the highlighting. Users won't understand the implication behind it just from highlighting, and if there is a warning I don't feel an extra highlight color would add much value.
I think this makes sense. As far as I understand, the current assumption is that shadowing unexposed classes should work (and it does work to some extent, despite possible issues). If we decide to limit this, then we shouldn't rely on syntax highlighting alone. And we can always revisit syntax highlighting in the future.
Thanks! |
Fixes #19834