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

Side by Side Diff: example/format.dart

Issue 834353002: camelCase constants. Down with ALL_CAPS! (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | lib/src/chunk.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 import 'package:dart_style/dart_style.dart'; 1 import 'package:dart_style/dart_style.dart';
2 2
3 import 'package:dart_style/src/debug.dart'; 3 import 'package:dart_style/src/debug.dart';
4 4
5 void main(List<String> args) { 5 void main(List<String> args) {
6 // Enable debugging so you can see some of the formatter's internal state. 6 // Enable debugging so you can see some of the formatter's internal state.
7 // Normal users do not do this. 7 // Normal users do not do this.
8 debugFormatter = true; 8 debugFormatter = true;
9 useAnsiColors = true; 9 useAnsiColors = true;
10 10
(...skipping 14 matching lines...) Expand all
25 var formatter = new DartFormatter(pageWidth: pageWidth); 25 var formatter = new DartFormatter(pageWidth: pageWidth);
26 26
27 var result; 27 var result;
28 if (isCompilationUnit) { 28 if (isCompilationUnit) {
29 result = formatter.format(source); 29 result = formatter.format(source);
30 } else { 30 } else {
31 result = formatter.formatStatement(source); 31 result = formatter.formatStatement(source);
32 } 32 }
33 33
34 if (useAnsiColors) { 34 if (useAnsiColors) {
35 result = result.replaceAll(" ", "\u001b[1;30m·\u001b[0m"); 35 result = result.replaceAll(
36 " ", "${Color.gray}$unicodeMidDot${Color.none}");
pquitslund 2015/01/06 19:36:25 Nice.
36 } 37 }
37 38
38 drawRuler("before", pageWidth); 39 drawRuler("before", pageWidth);
39 print(source); 40 print(source);
40 drawRuler("after", pageWidth); 41 drawRuler("after", pageWidth);
41 print(result); 42 print(result);
42 } on FormatterException catch (error) { 43 } on FormatterException catch (error) {
43 print(error.message()); 44 print(error.message());
44 } 45 }
45 } 46 }
46 47
47 void drawRuler(String label, int width) { 48 void drawRuler(String label, int width) {
48 var padding = " " * (width - label.length - 1); 49 var padding = " " * (width - label.length - 1);
49 print("$label:$padding|"); 50 print("$label:$padding|");
50 } 51 }
OLDNEW
« no previous file with comments | « no previous file | lib/src/chunk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698