Improve function and signal parameter highlighting, add shadowing warning #92085
+13
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that signal parameters got highlighted as class names if they matched, so it could potentially be confusing to see a signal declared as
signal name(bool)
, since at first glance it might seem like it accepts only booleans, when in fact that's just the parameter name. I also added a warning when any signal parameters shadow global class names, to discourage it.This led me down a bit of a rabbit hole with regards to syntax highlighting for function parameters in general, which suffered from the same problem, but the fix was similar to the one for signals except lambdas which was a bit more complicated since those were not being flagged properly when there was a space after the
func
token.I attempted a fix for that as well, although I'm not super familiar with this kind of code so there may be a cleaner fix.
Before:
After: