Open
Description
Running dartfmt
on:
void main() {
try {
print('hi');
} on Error catch (e) { // ignore: avoid_catching_errors
print('bye');
}
}
generates:
void main() {
try {
print('hi');
} on Error catch (e) {
// ignore: avoid_catching_errors
print('bye');
}
}
And now the // ignore:
comment is no longer referring to the intended line.
I don't think that this is quite the same as #546 since:
- The line doesn't need to be wrapped (it's shorter than 80 columns, and other than the presence of the comment, there's no other reason to split the line).
- I can't just add
// ignore:
to "the new lines if dartfmt splits something up".
I could move // ignore:
to be above the targeted line, but I'd prefer not to since it then looks like the comment belongs in the try
block. (That dartfmt
indents the comment in that case doesn't help.)
(I am using dartfmt 1.2.8 on linux x64.)