Not sure if this is intended, but feels like a bug. When using the tall experiment, carriage returns seem to be removed from the inside of strings.
Here's a repro:
Future<void> test_newlines() async {
var formatter = dart_style.DartFormatter();
var tallFormatter = dart_style.DartFormatter(
experimentFlags: [
'tall-style',
],
);
// The whole document uses \r\n, once inside the string and leading/trailing the code
var code = '\r\nvar a = """\r\ntest\r\n""";\r\n';
print(jsonEncode(code));
print(jsonEncode(formatter.format(code)));
print(jsonEncode(tallFormatter.format(code)));
}
And here's the output:
"\r\nvar a = \"\"\"\r\ntest\r\n\"\"\";\r\n"
"var a = \"\"\"\r\ntest\r\n\"\"\";\r\n"
"var a = \"\"\"\ntest\n\"\"\";\r\n"
^ ^ missing \r
The \r in the surrounding code was kept (at least at the end, the leading whitespace was removed as part of formatting), but inside the strings it was removed.
Not sure if this is intended, but feels like a bug. When using the tall experiment, carriage returns seem to be removed from the inside of strings.
Here's a repro:
And here's the output:
The
\r
in the surrounding code was kept (at least at the end, the leading whitespace was removed as part of formatting), but inside the strings it was removed.