-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
Milestone
Description
Editor: Adding a list of samples we should add tests for:
const array = [1, 2, 3].reduce<number[]>((acc, next) => [...acc, next], []);
return this.sides.every((length,width=(3+2+(4/5))) => length > 0 );
const bad = ((a, b) => [...a, b]);
const bad = (a => [...a, b]);
const bad = (_ => doSomething());
const good = () => 0;
const bad = (() => 0);- Nested parens in expressions
- () surrounded arguments
- flag argument with no ()
-
_argument
Possibly 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:
const array = [1, 2, 3].reduce<number[]>((acc, next) => [...acc, next], []);
// ~~~~~~~~
// Type of the initial value, in our case making it an array of numbers.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):



