| OLD | NEW |
| 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 library dart_style.src.line_writer; | 5 library dart_style.src.line_writer; |
| 6 | 6 |
| 7 import 'chunk.dart'; | 7 import 'chunk.dart'; |
| 8 import 'dart_formatter.dart'; | 8 import 'dart_formatter.dart'; |
| 9 import 'debug.dart' as debug; | 9 import 'debug.dart' as debug; |
| 10 import 'line_splitting/line_splitter.dart'; | 10 import 'line_splitting/line_splitter.dart'; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 {bool flushLeft}) { | 137 {bool flushLeft}) { |
| 138 // Write the newlines required by the previous line. | 138 // Write the newlines required by the previous line. |
| 139 for (var j = 0; j < newlines; j++) { | 139 for (var j = 0; j < newlines; j++) { |
| 140 _buffer.write(_lineEnding); | 140 _buffer.write(_lineEnding); |
| 141 } | 141 } |
| 142 | 142 |
| 143 var chunks = _chunks.sublist(start, end); | 143 var chunks = _chunks.sublist(start, end); |
| 144 | 144 |
| 145 if (debug.traceLineWriter) { | 145 if (debug.traceLineWriter) { |
| 146 debug.log(debug.green("\nWriting:")); | 146 debug.log(debug.green("\nWriting:")); |
| 147 debug.dumpChunks(start, chunks); | 147 debug.dumpChunks(0, chunks); |
| 148 debug.log(); | 148 debug.log(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 // Run the line splitter. | 151 // Run the line splitter. |
| 152 var splitter = new LineSplitter(this, chunks, _blockIndentation, indent, | 152 var splitter = new LineSplitter(this, chunks, _blockIndentation, indent, |
| 153 flushLeft: flushLeft); | 153 flushLeft: flushLeft); |
| 154 var splits = splitter.apply(); | 154 var splits = splitter.apply(); |
| 155 | 155 |
| 156 // Write the indentation of the first line. | 156 // Write the indentation of the first line. |
| 157 if (!flushLeft) { | 157 if (!flushLeft) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 final int selectionStart; | 270 final int selectionStart; |
| 271 | 271 |
| 272 /// Where in the resulting buffer the selection end point should appear if it | 272 /// Where in the resulting buffer the selection end point should appear if it |
| 273 /// was contained within this split list of chunks. | 273 /// was contained within this split list of chunks. |
| 274 /// | 274 /// |
| 275 /// Otherwise, this is `null`. | 275 /// Otherwise, this is `null`. |
| 276 final int selectionEnd; | 276 final int selectionEnd; |
| 277 | 277 |
| 278 FormatResult(this.text, this.cost, this.selectionStart, this.selectionEnd); | 278 FormatResult(this.text, this.cost, this.selectionStart, this.selectionEnd); |
| 279 } | 279 } |
| OLD | NEW |