Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: pkg/analyzer/lib/src/services/writer.dart

Issue 322563002: Formatter: fix for long multiline strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/services/writer.dart
diff --git a/pkg/analyzer/lib/src/services/writer.dart b/pkg/analyzer/lib/src/services/writer.dart
index d1437482530c66388d246ac3d3cf1f60f8ce7e20..1713224733ef28c405bb3b0ea2e5953500cb9949 100644
--- a/pkg/analyzer/lib/src/services/writer.dart
+++ b/pkg/analyzer/lib/src/services/writer.dart
@@ -350,8 +350,18 @@ class SourceWriter {
}
}
- void write(x) {
- _addToken(new LineToken(x));
+ void write(String string) {
+ List<String> lines = string.split(lineSeparator);
pquitslund 2014/06/06 17:18:53 I'd prefer no type annotations (besides the declar
scheglov 2014/06/06 17:25:37 Done.
+ int length = lines.length;
+ for (int i = 0; i < length; i++) {
+ String line = lines[i];
+ _addToken(new LineToken(line));
+ if (i != length - 1) {
+ newline();
+ // no indentation for multi-line strings
+ currentLine.clear();
+ }
+ }
}
void writeln(String s) {
« no previous file with comments | « no previous file | pkg/analyzer/test/services/formatter_test.dart » ('j') | pkg/analyzer/test/services/formatter_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698