godot
godot copied to clipboard
GDScript: Highlight script members like native ones
Closes godotengine/godot-proposals#6428.
Damn that was so fast, I didn't think anyone would give my proposal a second thought. I appreciate it a lot, it'll help me (and hopefully others) a lot.
LGTM, I was thinking roughly the same implementation while looking into why this happens. update_cache()
is starting to get quite heavy, but it's probably not a problem.
How does it look when you shadow member variables in functions and code blocks?
Right now the highlighter doesn't use code analysis, so if you have identifier shadowing, highlight collisions are possible.
I think that's something it should be able to do, otherwise it would add potential for confusion that's not present right now.
The confusion is already there, if you shadow a native property or use inner classes with name collisions. To fix this, we need to rewrite the highlighter. I have some ideas how to do this without using the parser and analyzer, but for now I would prefer this solution with minimal changes, even if it is not perfect.
You're right, but look at it this way: Right now members aren't highlighted, which is a pity but at least the editor doesn't lie to you. If members were highlighted, but sometimes not correctly, there'd be a bug now where previously there was none. That doesn't sound right to me.
No, the editor could lie to you before, in the case of native members. You are not suggesting to stop highlighting them to avoid the error, right? Most of the highlighters that I have seen in various text editors and other interfaces were not perfect, to one degree or another.
Also, shadowing identifiers is not recommended - it causes a warning by default. I still see this change as doing more good than harm. But yes, we should think about a significant overhaul of the highlighter in the future.
poke poke?
Bless you. What's the status of this? May I poke in, too? It's a huge QoL improvement.
Any news? I need this in my life.
Bless you. What's the status of this? May I poke in, too? It's a huge QoL improvement.
@TinyTakinTeller Please don't bump without contributing significant new information. Use the :+1: reaction button on the first post instead.