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

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

Issue 1492683002: Change the way hard splits are handled. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Created 5 years 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 | « lib/src/line_splitting/solve_state.dart ('k') | lib/src/rule/argument.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 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
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
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 }
OLDNEW
« no previous file with comments | « lib/src/line_splitting/solve_state.dart ('k') | lib/src/rule/argument.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698