| OLD | NEW |
| 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 // This file has been automatically generated. Please do not edit it manually. | 5 // This file has been automatically generated. Please do not edit it manually. |
| 6 // To regenerate the file, use the script | 6 // To regenerate the file, use the script |
| 7 // "pkg/analysis_server/tool/spec/generate_files". | 7 // "pkg/analysis_server/tool/spec/generate_files". |
| 8 | 8 |
| 9 part of protocol; | 9 part of protocol; |
| 10 /** | 10 /** |
| (...skipping 3315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3326 int get hashCode { | 3326 int get hashCode { |
| 3327 int hash = 0; | 3327 int hash = 0; |
| 3328 hash = _JenkinsSmiHash.combine(hash, id.hashCode); | 3328 hash = _JenkinsSmiHash.combine(hash, id.hashCode); |
| 3329 hash = _JenkinsSmiHash.combine(hash, results.hashCode); | 3329 hash = _JenkinsSmiHash.combine(hash, results.hashCode); |
| 3330 hash = _JenkinsSmiHash.combine(hash, isLast.hashCode); | 3330 hash = _JenkinsSmiHash.combine(hash, isLast.hashCode); |
| 3331 return _JenkinsSmiHash.finish(hash); | 3331 return _JenkinsSmiHash.finish(hash); |
| 3332 } | 3332 } |
| 3333 } | 3333 } |
| 3334 | 3334 |
| 3335 /** | 3335 /** |
| 3336 * edit.format params |
| 3337 * |
| 3338 * { |
| 3339 * "file": FilePath |
| 3340 * "selectionOffset": int |
| 3341 * "selectionLength": int |
| 3342 * } |
| 3343 */ |
| 3344 class EditFormatParams implements HasToJson { |
| 3345 /** |
| 3346 * The file containing the code to be formatted. |
| 3347 */ |
| 3348 String file; |
| 3349 |
| 3350 /** |
| 3351 * The offset of the current selection in the file. |
| 3352 */ |
| 3353 int selectionOffset; |
| 3354 |
| 3355 /** |
| 3356 * The length of the current selection in the file. |
| 3357 */ |
| 3358 int selectionLength; |
| 3359 |
| 3360 EditFormatParams(this.file, this.selectionOffset, this.selectionLength); |
| 3361 |
| 3362 factory EditFormatParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob
ject json) { |
| 3363 if (json == null) { |
| 3364 json = {}; |
| 3365 } |
| 3366 if (json is Map) { |
| 3367 String file; |
| 3368 if (json.containsKey("file")) { |
| 3369 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); |
| 3370 } else { |
| 3371 throw jsonDecoder.missingKey(jsonPath, "file"); |
| 3372 } |
| 3373 int selectionOffset; |
| 3374 if (json.containsKey("selectionOffset")) { |
| 3375 selectionOffset = jsonDecoder._decodeInt(jsonPath + ".selectionOffset",
json["selectionOffset"]); |
| 3376 } else { |
| 3377 throw jsonDecoder.missingKey(jsonPath, "selectionOffset"); |
| 3378 } |
| 3379 int selectionLength; |
| 3380 if (json.containsKey("selectionLength")) { |
| 3381 selectionLength = jsonDecoder._decodeInt(jsonPath + ".selectionLength",
json["selectionLength"]); |
| 3382 } else { |
| 3383 throw jsonDecoder.missingKey(jsonPath, "selectionLength"); |
| 3384 } |
| 3385 return new EditFormatParams(file, selectionOffset, selectionLength); |
| 3386 } else { |
| 3387 throw jsonDecoder.mismatch(jsonPath, "edit.format params"); |
| 3388 } |
| 3389 } |
| 3390 |
| 3391 factory EditFormatParams.fromRequest(Request request) { |
| 3392 return new EditFormatParams.fromJson( |
| 3393 new RequestDecoder(request), "params", request._params); |
| 3394 } |
| 3395 |
| 3396 Map<String, dynamic> toJson() { |
| 3397 Map<String, dynamic> result = {}; |
| 3398 result["file"] = file; |
| 3399 result["selectionOffset"] = selectionOffset; |
| 3400 result["selectionLength"] = selectionLength; |
| 3401 return result; |
| 3402 } |
| 3403 |
| 3404 Request toRequest(String id) { |
| 3405 return new Request(id, "edit.format", toJson()); |
| 3406 } |
| 3407 |
| 3408 @override |
| 3409 String toString() => JSON.encode(toJson()); |
| 3410 |
| 3411 @override |
| 3412 bool operator==(other) { |
| 3413 if (other is EditFormatParams) { |
| 3414 return file == other.file && |
| 3415 selectionOffset == other.selectionOffset && |
| 3416 selectionLength == other.selectionLength; |
| 3417 } |
| 3418 return false; |
| 3419 } |
| 3420 |
| 3421 @override |
| 3422 int get hashCode { |
| 3423 int hash = 0; |
| 3424 hash = _JenkinsSmiHash.combine(hash, file.hashCode); |
| 3425 hash = _JenkinsSmiHash.combine(hash, selectionOffset.hashCode); |
| 3426 hash = _JenkinsSmiHash.combine(hash, selectionLength.hashCode); |
| 3427 return _JenkinsSmiHash.finish(hash); |
| 3428 } |
| 3429 } |
| 3430 |
| 3431 /** |
| 3432 * edit.format result |
| 3433 * |
| 3434 * { |
| 3435 * "edits": List<SourceEdit> |
| 3436 * "selectionOffset": int |
| 3437 * "selectionLength": int |
| 3438 * } |
| 3439 */ |
| 3440 class EditFormatResult implements HasToJson { |
| 3441 /** |
| 3442 * The edit(s) to be applied in order to format the code. The list will be |
| 3443 * empty if the code was already formatted (there are no changes). |
| 3444 */ |
| 3445 List<SourceEdit> edits; |
| 3446 |
| 3447 /** |
| 3448 * The offset of the selection after formatting the code. |
| 3449 */ |
| 3450 int selectionOffset; |
| 3451 |
| 3452 /** |
| 3453 * The length of the selection after formatting the code. |
| 3454 */ |
| 3455 int selectionLength; |
| 3456 |
| 3457 EditFormatResult(this.edits, this.selectionOffset, this.selectionLength); |
| 3458 |
| 3459 factory EditFormatResult.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob
ject json) { |
| 3460 if (json == null) { |
| 3461 json = {}; |
| 3462 } |
| 3463 if (json is Map) { |
| 3464 List<SourceEdit> edits; |
| 3465 if (json.containsKey("edits")) { |
| 3466 edits = jsonDecoder._decodeList(jsonPath + ".edits", json["edits"], (Str
ing jsonPath, Object json) => new SourceEdit.fromJson(jsonDecoder, jsonPath, jso
n)); |
| 3467 } else { |
| 3468 throw jsonDecoder.missingKey(jsonPath, "edits"); |
| 3469 } |
| 3470 int selectionOffset; |
| 3471 if (json.containsKey("selectionOffset")) { |
| 3472 selectionOffset = jsonDecoder._decodeInt(jsonPath + ".selectionOffset",
json["selectionOffset"]); |
| 3473 } else { |
| 3474 throw jsonDecoder.missingKey(jsonPath, "selectionOffset"); |
| 3475 } |
| 3476 int selectionLength; |
| 3477 if (json.containsKey("selectionLength")) { |
| 3478 selectionLength = jsonDecoder._decodeInt(jsonPath + ".selectionLength",
json["selectionLength"]); |
| 3479 } else { |
| 3480 throw jsonDecoder.missingKey(jsonPath, "selectionLength"); |
| 3481 } |
| 3482 return new EditFormatResult(edits, selectionOffset, selectionLength); |
| 3483 } else { |
| 3484 throw jsonDecoder.mismatch(jsonPath, "edit.format result"); |
| 3485 } |
| 3486 } |
| 3487 |
| 3488 factory EditFormatResult.fromResponse(Response response) { |
| 3489 return new EditFormatResult.fromJson( |
| 3490 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), "
result", response._result); |
| 3491 } |
| 3492 |
| 3493 Map<String, dynamic> toJson() { |
| 3494 Map<String, dynamic> result = {}; |
| 3495 result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList(); |
| 3496 result["selectionOffset"] = selectionOffset; |
| 3497 result["selectionLength"] = selectionLength; |
| 3498 return result; |
| 3499 } |
| 3500 |
| 3501 Response toResponse(String id) { |
| 3502 return new Response(id, result: toJson()); |
| 3503 } |
| 3504 |
| 3505 @override |
| 3506 String toString() => JSON.encode(toJson()); |
| 3507 |
| 3508 @override |
| 3509 bool operator==(other) { |
| 3510 if (other is EditFormatResult) { |
| 3511 return _listEqual(edits, other.edits, (SourceEdit a, SourceEdit b) => a ==
b) && |
| 3512 selectionOffset == other.selectionOffset && |
| 3513 selectionLength == other.selectionLength; |
| 3514 } |
| 3515 return false; |
| 3516 } |
| 3517 |
| 3518 @override |
| 3519 int get hashCode { |
| 3520 int hash = 0; |
| 3521 hash = _JenkinsSmiHash.combine(hash, edits.hashCode); |
| 3522 hash = _JenkinsSmiHash.combine(hash, selectionOffset.hashCode); |
| 3523 hash = _JenkinsSmiHash.combine(hash, selectionLength.hashCode); |
| 3524 return _JenkinsSmiHash.finish(hash); |
| 3525 } |
| 3526 } |
| 3527 |
| 3528 /** |
| 3336 * edit.getAssists params | 3529 * edit.getAssists params |
| 3337 * | 3530 * |
| 3338 * { | 3531 * { |
| 3339 * "file": FilePath | 3532 * "file": FilePath |
| 3340 * "offset": int | 3533 * "offset": int |
| 3341 * "length": int | 3534 * "length": int |
| 3342 * } | 3535 * } |
| 3343 */ | 3536 */ |
| 3344 class EditGetAssistsParams implements HasToJson { | 3537 class EditGetAssistsParams implements HasToJson { |
| 3345 /** | 3538 /** |
| (...skipping 7448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10794 return false; | 10987 return false; |
| 10795 } | 10988 } |
| 10796 | 10989 |
| 10797 @override | 10990 @override |
| 10798 int get hashCode { | 10991 int get hashCode { |
| 10799 int hash = 0; | 10992 int hash = 0; |
| 10800 hash = _JenkinsSmiHash.combine(hash, newName.hashCode); | 10993 hash = _JenkinsSmiHash.combine(hash, newName.hashCode); |
| 10801 return _JenkinsSmiHash.finish(hash); | 10994 return _JenkinsSmiHash.finish(hash); |
| 10802 } | 10995 } |
| 10803 } | 10996 } |
| OLD | NEW |