You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Format function types.
This involves formatting parameter lists which is a big piece of work.
They work similar to argument lists and collection literals... except
for the special syntax around `[ ... ]` and `{ ... }` for optional
parameters.
Getting that working right involved adding some more functionality to
DelimitedListBuilder and ListPiece.
Getting comments working with that syntax was particularly difficult.
I ended up deciding that the formatter can move comments before or after
the optional parameter delimiters if it needs to. Doing so produces
better looking output, as in:
```
// Before:
f(// weird comment location
[param] // another
);
// After:
f([
// weird comment location
param, // another
]);
```
It also, I think is cleaner to implement than trying to laboriously
keep the comment where the user authored it.
In the process of reworking how comments are handled in lists, I also
tweaked how inline block comments are handled before commas. Previously,
they would get moved after the comma, like:
```
// Before:
[element /* comment */, another];
// After:
[element, /* comment */ another];
```
Now, they stay where they were, which is I think what users want. A
common use case for block comments in argument/collection lists is
describing the meaning of a preceding null argument and this keeps that.
Line after an element but before the comma continue to be moved after
the comma:
```
// Before:
f(param // comment
,);
// After:
f(
param, // comment
);
```
Also:
- Added tests for the loosened behavior of equalIgnoringWhitespace().
- Added a test for a corner case of variable splitting that I ran into
with parameters, which use the same VariablePiece.
* Add TODO comment to investigate something better than
equalIgnoringWhitespace().
* Apply review feedback.
0 commit comments