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

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

Issue 822273004: Add API to provide a selection range, and return the updated selection after formatting. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Remove redundant argument check. Created 5 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 unified diff | Download patch
« no previous file with comments | « lib/src/dart_formatter.dart ('k') | lib/src/line_splitter.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.formatter_exception; 5 library dart_style.src.formatter_exception;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:source_span/source_span.dart'; 8 import 'package:source_span/source_span.dart';
9 9
10 /// Thrown when one or more errors occurs while parsing the code to be 10 /// Thrown when one or more errors occurs while parsing the code to be
(...skipping 14 matching lines...) Expand all
25 var file = new SourceFile(error.source.contents.data, 25 var file = new SourceFile(error.source.contents.data,
26 url: error.source.fullName); 26 url: error.source.fullName);
27 27
28 var span = file.span(error.offset, error.offset + error.length); 28 var span = file.span(error.offset, error.offset + error.length);
29 if (buffer.isNotEmpty) buffer.writeln(); 29 if (buffer.isNotEmpty) buffer.writeln();
30 buffer.write(span.message(error.message, color: true)); 30 buffer.write(span.message(error.message, color: true));
31 } 31 }
32 32
33 return buffer.toString(); 33 return buffer.toString();
34 } 34 }
35
36 String toString() => message();
35 } 37 }
OLDNEW
« no previous file with comments | « lib/src/dart_formatter.dart ('k') | lib/src/line_splitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698