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

Side by Side Diff: pkg/analyzer_experimental/bin/formatter.dart

Issue 25290002: Format selection preservation editor bits. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 2
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 // for details. All rights reserved. Use of this source code is governed by a 4 // for details. All rights reserved. Use of this source code is governed by a
5 // BSD-style license that can be found in the LICENSE file. 5 // BSD-style license that can be found in the LICENSE file.
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:utf'; 9 import 'dart:utf';
10 10
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 CodeKind.COMPILATION_UNIT, src, selection: selection); 152 CodeKind.COMPILATION_UNIT, src, selection: selection);
153 if (machineFormat) { 153 if (machineFormat) {
154 return _toJson(formatResult); 154 return _toJson(formatResult);
155 } 155 }
156 return formatResult.source; 156 return formatResult.source;
157 } 157 }
158 158
159 _toJson(formatResult) => 159 _toJson(formatResult) =>
160 // Actual JSON format TBD 160 // Actual JSON format TBD
161 JSON.encode({'source': formatResult.source, 161 JSON.encode({'source': formatResult.source,
162 'selection': formatResult.selection.toString()}); 162 'selection': {
163 'offset': formatResult.selection.offset,
164 'length': formatResult.selection.length
165 }
166 });
163 167
164 /// Log the given [msg]. 168 /// Log the given [msg].
165 _log(String msg) { 169 _log(String msg) {
166 //TODO(pquitslund): add proper log support 170 //TODO(pquitslund): add proper log support
167 print(msg); 171 print(msg);
168 } 172 }
OLDNEW
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/DartEditor.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698