-
Notifications
You must be signed in to change notification settings - Fork 57
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
Highlight tagged template fn as fn #920
Conversation
@zth @fhammerschmidt I wonder how correct it is to highlight it as a function, when we usually treat functions as regular variables in other places |
Other variables we don't know whether they're functions or not, because we'd need to do potentially expensive lookups. This one we always know is a function because only a function can be used as a tagged template literal function. |
I'm just thinking that it might be better to be consistent in not highlighting functions |
I don't think that's a problem, this is also a pretty isolated context from other functions so it's fine. |
By the way, do you know how TS does it? |
They use semantic highlighting, and look up the actual type definition for each identifier to see if it's a function. We could do the same, but we'd need to benchmark it because it might be taxing on performance. So far we haven't used any of the type information for highlighting (IIRC). But we could probably try it out as an experiment, should be easy enough. Would be good to have benchmarks for it. |
I see. But I actually like functions of the same color as variables 😁 |
* highlight tagged template fn as fn * changelog
This highlights tagged template functions used as a function.
Before:
After: