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

Side by Side Diff: pkg/analysis_server/lib/src/services/correction/change.dart

Issue 495733002: Don't use LinkedEditGroup.id. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 // 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 services.correction.change; 5 library services.correction.change;
6 6
7 import 'package:analysis_server/src/constants.dart'; 7 import 'package:analysis_server/src/constants.dart';
8 import 'package:analysis_server/src/protocol2.dart'; 8 import 'package:analysis_server/src/protocol2.dart';
9 import 'package:analysis_server/src/services/json.dart'; 9 import 'package:analysis_server/src/services/json.dart';
10 import 'package:analyzer/src/generated/source.dart'; 10 import 'package:analyzer/src/generated/source.dart';
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 String toString() => "FileEdit(file=$file, edits=$edits)"; 169 String toString() => "FileEdit(file=$file, edits=$edits)";
170 } 170 }
171 171
172 172
173 /** 173 /**
174 * A group of linked [Position]s in multiple files that are simultaneously 174 * A group of linked [Position]s in multiple files that are simultaneously
175 * modified - if one gets edited, all other positions in a group are edited the 175 * modified - if one gets edited, all other positions in a group are edited the
176 * same way. All linked positions in a group have the same content. 176 * same way. All linked positions in a group have the same content.
177 */ 177 */
178 class LinkedEditGroup implements HasToJson { 178 class LinkedEditGroup implements HasToJson {
179 final String id;
180 int length; 179 int length;
181 final List<Position> positions = <Position>[]; 180 final List<Position> positions = <Position>[];
182 final List<LinkedEditSuggestion> suggestions = <LinkedEditSuggestion>[]; 181 final List<LinkedEditSuggestion> suggestions = <LinkedEditSuggestion>[];
183 182
184 LinkedEditGroup(this.id);
185
186 void addPosition(Position position, int length) { 183 void addPosition(Position position, int length) {
187 positions.add(position); 184 positions.add(position);
188 this.length = length; 185 this.length = length;
189 } 186 }
190 187
191 void addSuggestion(LinkedEditSuggestion suggestion) { 188 void addSuggestion(LinkedEditSuggestion suggestion) {
192 suggestions.add(suggestion); 189 suggestions.add(suggestion);
193 } 190 }
194 191
195 @override 192 @override
196 Map<String, Object> toJson() { 193 Map<String, Object> toJson() {
197 return { 194 return {
198 ID: id,
199 LENGTH: length, 195 LENGTH: length,
200 POSITIONS: objectToJson(positions), 196 POSITIONS: objectToJson(positions),
201 SUGGESTIONS: objectToJson(suggestions) 197 SUGGESTIONS: objectToJson(suggestions)
202 }; 198 };
203 } 199 }
204 200
205 @override 201 @override
206 String toString() => 202 String toString() =>
207 'LinkedEditGroup(id=$id, length=$length, ' 203 'LinkedEditGroup(length=$length, positions=$positions, suggestions=$sugges tions)';
208 'positions=$positions, suggestions=$suggestions)';
209 } 204 }
210 205
211 206
212 /** 207 /**
213 * A suggestion of a value that could be used to replace all of the linked edit 208 * A suggestion of a value that could be used to replace all of the linked edit
214 * regions in a [LinkedEditGroup]. 209 * regions in a [LinkedEditGroup].
215 */ 210 */
216 class LinkedEditSuggestion implements HasToJson { 211 class LinkedEditSuggestion implements HasToJson {
217 final LinkedEditSuggestionKind kind; 212 final LinkedEditSuggestionKind kind;
218 final String value; 213 final String value;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 Map<String, Object> toJson() { 277 Map<String, Object> toJson() {
283 return { 278 return {
284 FILE: file, 279 FILE: file,
285 OFFSET: offset 280 OFFSET: offset
286 }; 281 };
287 } 282 }
288 283
289 @override 284 @override
290 String toString() => 'Position(file=$file, offset=$offset)'; 285 String toString() => 'Position(file=$file, offset=$offset)';
291 } 286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698