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
[JavaScript] Rationalize function name detection. #2267
Labels
Comments
Closed with #2417? |
That one improves arrow function detection, but it still uses awkward lookaheads to highlight the “names” of anonymous functions. I've been looking into ways to rewrite that to avoid the messy lookaheads, but haven't hit upon the right implementation yet. |
This was referenced Nov 6, 2020
This was referenced Nov 24, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In some cases, the current JavaScript syntax will highlight a variable name, mapping key, or property name as a function name (
entity.name.function
):Originally, this seems to have been a convenience feature for display purposes. The implementation uses lookaheads and is not reliable, leading to an uneven user experience.
However, there is a real JavaScript feature by which anonymous functions will be named using the surrounding context in some cases. We could detect most of these cases using branching and reimplement the special name highlighting in terms of the language feature. This would seem to be the most correct way of handling what is otherwise a vaguely-motivated special case.
The text was updated successfully, but these errors were encountered: