Discussion:
[dart-misc] What does the formatter indent this code by an extra 4 spaces, not 2?
Danny Tuppeny
2016-08-09 18:27:53 UTC
Permalink
The formatter does this to my code:

List<String> read(String filename) {
var file = new File(filename);
if (!file.existsSync()) {
return new List<String>();
}

return file
.readAsLinesSync() // Why are these lines 6 spaces in, not 4?
.map((l) => l.trim())
.where((l) => l != null && !l.isEmpty)
.toList();
}

I don't really understand why the code in the lines after "return" is being
intended 4 spaces more than the return. Any ideas?
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Günter Zöchbauer
2016-08-09 20:35:16 UTC
Permalink
block content is indented 2, line continuation 4
should be explained in more detail in the Dart style guide
Post by Danny Tuppeny
List<String> read(String filename) {
var file = new File(filename);
if (!file.existsSync()) {
return new List<String>();
}
return file
.readAsLinesSync() // Why are these lines 6 spaces in, not 4?
.map((l) => l.trim())
.where((l) => l != null && !l.isEmpty)
.toList();
}
I don't really understand why the code in the lines after "return" is
being intended 4 spaces more than the return. Any ideas?
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Danny Tuppeny
2016-08-09 20:40:07 UTC
Permalink
Post by Günter Zöchbauer
block content is indented 2, line continuation 4
should be explained in more detail in the Dart style guide
Aha; it is :) I hadn't noticed it was different before now. I should
probably read through the style guide!
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Loading...