OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library formatter_impl; | 5 library formatter_impl; |
6 | 6 |
7 import 'dart:math'; | 7 import 'dart:math'; |
8 | 8 |
9 import 'package:analyzer_experimental/analyzer.dart'; | 9 import 'package:analyzer/analyzer.dart'; |
10 import 'package:analyzer_experimental/src/generated/java_core.dart' show CharSeq
uence; | 10 import 'package:analyzer/src/generated/java_core.dart' show CharSequence; |
11 import 'package:analyzer_experimental/src/generated/parser.dart'; | 11 import 'package:analyzer/src/generated/parser.dart'; |
12 import 'package:analyzer_experimental/src/generated/scanner.dart'; | 12 import 'package:analyzer/src/generated/scanner.dart'; |
13 import 'package:analyzer_experimental/src/generated/source.dart'; | 13 import 'package:analyzer/src/generated/source.dart'; |
14 import 'package:analyzer_experimental/src/services/writer.dart'; | 14 import 'package:analyzer/src/services/writer.dart'; |
15 | 15 |
16 /// Formatter options. | 16 /// Formatter options. |
17 class FormatterOptions { | 17 class FormatterOptions { |
18 | 18 |
19 /// Create formatter options with defaults derived (where defined) from | 19 /// Create formatter options with defaults derived (where defined) from |
20 /// the style guide: <http://www.dartlang.org/articles/style-guide/>. | 20 /// the style guide: <http://www.dartlang.org/articles/style-guide/>. |
21 const FormatterOptions({this.initialIndentationLevel: 0, | 21 const FormatterOptions({this.initialIndentationLevel: 0, |
22 this.spacesPerIndent: 2, | 22 this.spacesPerIndent: 2, |
23 this.lineSeparator: NEW_LINE, | 23 this.lineSeparator: NEW_LINE, |
24 this.pageWidth: 80, | 24 this.pageWidth: 80, |
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 var lastLine = | 1526 var lastLine = |
1527 lineInfo.getLocation(lastOffset).lineNumber; | 1527 lineInfo.getLocation(lastOffset).lineNumber; |
1528 var currentLine = | 1528 var currentLine = |
1529 lineInfo.getLocation(currentOffset).lineNumber; | 1529 lineInfo.getLocation(currentOffset).lineNumber; |
1530 return currentLine - lastLine; | 1530 return currentLine - lastLine; |
1531 } | 1531 } |
1532 | 1532 |
1533 String toString() => writer.toString(); | 1533 String toString() => writer.toString(); |
1534 | 1534 |
1535 } | 1535 } |
OLD | NEW |