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

Unified Diff: pkg/analyzer/lib/src/services/writer.dart

Issue 196243003: Formatter space/tab width configuration fixes (dartbug.com/16969). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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/test/services/formatter_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/services/writer.dart
===================================================================
--- pkg/analyzer/lib/src/services/writer.dart (revision 33551)
+++ pkg/analyzer/lib/src/services/writer.dart (working copy)
@@ -35,7 +35,8 @@
bool isEmpty() => tokens.isEmpty;
- bool isWhitespace() => tokens.every((tok) => tok is SpaceToken);
+ bool isWhitespace() => tokens.every(
+ (tok) => tok is SpaceToken || tok is TabToken);
void indent(int n) {
tokens.insert(0,
@@ -298,12 +299,14 @@
final String lineSeparator;
int indentCount = 0;
+ final int spacesPerIndent;
+ final bool useTabs;
LinePrinter linePrinter;
LineToken _lastToken;
SourceWriter({this.indentCount: 0, this.lineSeparator: NEW_LINE,
- bool useTabs: false, int spacesPerIndent: 2, int maxLineLength: 80}) {
+ this.useTabs: false, this.spacesPerIndent: 2, int maxLineLength: 80}) {
if (maxLineLength > 0) {
linePrinter = new SimpleLineBreaker(maxLineLength, (n) =>
getIndentString(n, useTabs: useTabs, spacesPerIndent: spacesPerIndent));
@@ -368,7 +371,8 @@
}
}
- Line newLine() => new Line(indentLevel: indentCount, printer: linePrinter);
+ Line newLine() => new Line(indentLevel: indentCount, useTabs: useTabs,
+ spacesPerIndent: spacesPerIndent, printer: linePrinter);
String toString() {
var source = new StringBuffer(buffer.toString());
« no previous file with comments | « no previous file | pkg/analyzer/test/services/formatter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698