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

Side by Side Diff: lib/src/debug.dart

Issue 2333373003: Add a command-line option to set the exit code on a formatting change. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « bin/format.dart ('k') | lib/src/formatter_options.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Internal debugging utilities. 5 /// Internal debugging utilities.
6 library dart_style.src.debug; 6 library dart_style.src.debug;
7 7
8 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'chunk.dart'; 10 import 'chunk.dart';
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 if (chunk.isBlock) addSpans(chunk.block.chunks); 79 if (chunk.isBlock) addSpans(chunk.block.chunks);
80 } 80 }
81 } 81 }
82 82
83 addSpans(chunks); 83 addSpans(chunks);
84 84
85 var spans = spanSet.toList(); 85 var spans = spanSet.toList();
86 var rules = 86 var rules =
87 chunks.map((chunk) => chunk.rule).where((rule) => rule != null).toSet(); 87 chunks.map((chunk) => chunk.rule).where((rule) => rule != null).toSet();
88 88
89 var rows = []; 89 var rows = <List<String>>[];
90 90
91 addChunk(List<Chunk> chunks, String prefix, int index) { 91 addChunk(List<Chunk> chunks, String prefix, int index) {
92 var row = []; 92 var row = <String>[];
93 row.add("$prefix$index:"); 93 row.add("$prefix$index:");
94 94
95 var chunk = chunks[index]; 95 var chunk = chunks[index];
96 if (chunk.text.length > 70) { 96 if (chunk.text.length > 70) {
97 row.add(chunk.text.substring(0, 70)); 97 row.add(chunk.text.substring(0, 70));
98 } else { 98 } else {
99 row.add(chunk.text); 99 row.add(chunk.text);
100 } 100 }
101 101
102 if (spans.length <= 20) { 102 if (spans.length <= 20) {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 if (chunk.spaceWhenUnsplit) buffer.write(" "); 254 if (chunk.spaceWhenUnsplit) buffer.write(" ");
255 } 255 }
256 } 256 }
257 257
258 buffer.write(chunks.last.text); 258 buffer.write(chunks.last.text);
259 log(buffer); 259 log(buffer);
260 } 260 }
261 261
262 String _color(String ansiEscape) => useAnsiColors ? ansiEscape : ""; 262 String _color(String ansiEscape) => useAnsiColors ? ansiEscape : "";
OLDNEW
« no previous file with comments | « bin/format.dart ('k') | lib/src/formatter_options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698