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

Unified Diff: pkg/analyzer/bin/formatter.dart

Issue 139263011: dartfmt line wrapping bypass option support. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/services/formatter_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/bin/formatter.dart
===================================================================
--- pkg/analyzer/bin/formatter.dart (revision 32027)
+++ pkg/analyzer/bin/formatter.dart (working copy)
@@ -63,7 +63,7 @@
selection = _parseSelection(options[SELECTION_FLAG]);
formatterSettings =
new FormatterOptions(codeTransforms: options[TRANSFORM_FLAG],
- pageWidth: _toInt(options[MAX_LINE_FLAG]));
+ pageWidth: _parseLineLength(options[MAX_LINE_FLAG]));
}
CodeKind _parseKind(kindOption) {
@@ -75,6 +75,21 @@
}
}
+int _parseLineLength(String lengthOption) {
+ var length = _toInt(lengthOption);
+ if (length == null) {
+ var val = lengthOption.toUpperCase();
+ if (val == 'INF' || val == 'INFINITY') {
+ length = -1;
+ } else {
+ throw new FormatterException('Line length is specified as an Integer or '
+ 'the value "Inf".');
+ }
+ }
+ return length;
+}
+
+
Selection _parseSelection(selectionOption) {
if (selectionOption != null) {
var units = selectionOption.split(',');
@@ -159,10 +174,11 @@
parser.addFlag(TRANSFORM_FLAG, abbr: 't', negatable: false,
help: 'Perform code transformations.');
parser.addOption(MAX_LINE_FLAG, abbr: 'l', defaultsTo: '80',
- help: 'Wrap lines longer than this length.');
+ help: 'Wrap lines longer than this length. '
+ 'To never wrap, specify "Infinity" or "Inf" for short.');
parser.addOption(KIND_FLAG, abbr: 'k', defaultsTo: 'cu',
- help: 'Specify source snippet kind ("stmt" or "cu")'
- ' --- [PROVISIONAL API].', hide: true);
+ help: 'Specify source snippet kind ("stmt" or "cu") '
+ '--- [PROVISIONAL API].', hide: true);
parser.addOption(SELECTION_FLAG, abbr: 's',
help: 'Specify selection information as an offset,length pair '
'(e.g., -s "0,4").', hide: true);
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/services/formatter_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698