-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
(typescript) snippet containing a lambda which parameters are enclosed in parens fails #2189
Comments
This seems to be something to do with the parens enclosing that arrow function. Here's some minimal reproductions: |
You know you can put multiple examples in a single fiddle, right? 🙂 |
Ahehe 😅 sure I knew that: |
Sure it’s not the number in brackets before it? |
Even the following snippet will break the highlighting: const good = () => 0;
// comment
const bad = (() => 0);
// comment |
Someone looking into this might want to look at Javascript which has this same type of structure, but I believe it works in that grammar. |
Just if someone try to fix this: Javascript and Typescript markups for enclosed lambda functions are broken, so both needs to be fixed. Javascript does not produce this error on the comment, but this is the rendered markup: Note the paren at params start against a properly render markup: See this for more. |
Thanks, I also updated the original message here with more detail. |
Actually you might be able to get away with just either/oring them since it's just a "preflight" check: Ie:
And when it goes to parse let the rule handle it. |
@mondeja Does my last comment make sense or did you give up on this? |
I have given up for now. |
Thanks for trying! |
Editor: Adding a list of samples we should add tests for:
_
argumentPossibly relevant:
https://stackoverflow.com/questions/18703187/count-parentheses-with-regular-expression
Since to do this I think we really need to count parens in the regex that's matching => functions.
This is an issue I noticed downstream in VS Code itself and in the output of Asciidoctor which uses highlightjs. The snippet causing issues is this one:
And gets rendered in VS Code and Asciidoctor generated HTML as follows:
When removing the arrowhead of the lambda (even though syntactically incorrect) the formatting is correct once again (since the comment at the ends gets picked up as a comment):
The text was updated successfully, but these errors were encountered: