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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; | 7 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; |
8 import 'package:analysis_server/plugin/edit/assist/assist_dart.dart'; | 8 import 'package:analysis_server/plugin/edit/assist/assist_dart.dart'; |
9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; | 9 import 'package:analysis_server/plugin/edit/fix/fix_core.dart'; |
10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; | 10 import 'package:analysis_server/plugin/edit/fix/fix_dart.dart'; |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 } | 496 } |
497 // Do sort. | 497 // Do sort. |
498 MemberSorter sorter = new MemberSorter(code, unit); | 498 MemberSorter sorter = new MemberSorter(code, unit); |
499 List<SourceEdit> edits = sorter.sort(); | 499 List<SourceEdit> edits = sorter.sort(); |
500 SourceFileEdit fileEdit = new SourceFileEdit(file, fileStamp, edits: edits); | 500 SourceFileEdit fileEdit = new SourceFileEdit(file, fileStamp, edits: edits); |
501 server.sendResponse( | 501 server.sendResponse( |
502 new EditSortMembersResult(fileEdit).toResponse(request.id)); | 502 new EditSortMembersResult(fileEdit).toResponse(request.id)); |
503 } | 503 } |
504 | 504 |
505 Response _getAvailableRefactorings(Request request) { | 505 Response _getAvailableRefactorings(Request request) { |
506 if (searchEngine == null) { | |
507 return new Response.noIndexGenerated(request); | |
508 } | |
509 _getAvailableRefactoringsImpl(request); | 506 _getAvailableRefactoringsImpl(request); |
510 return Response.DELAYED_RESPONSE; | 507 return Response.DELAYED_RESPONSE; |
511 } | 508 } |
512 | 509 |
513 Future _getAvailableRefactoringsImpl(Request request) async { | 510 Future _getAvailableRefactoringsImpl(Request request) async { |
514 // prepare parameters | 511 // prepare parameters |
515 var params = new EditGetAvailableRefactoringsParams.fromRequest(request); | 512 var params = new EditGetAvailableRefactoringsParams.fromRequest(request); |
516 String file = params.file; | 513 String file = params.file; |
517 int offset = params.offset; | 514 int offset = params.offset; |
518 int length = params.length; | 515 int length = params.length; |
(...skipping 26 matching lines...) Expand all Loading... |
545 } | 542 } |
546 } | 543 } |
547 } | 544 } |
548 } | 545 } |
549 // respond | 546 // respond |
550 var result = new EditGetAvailableRefactoringsResult(kinds); | 547 var result = new EditGetAvailableRefactoringsResult(kinds); |
551 server.sendResponse(result.toResponse(request.id)); | 548 server.sendResponse(result.toResponse(request.id)); |
552 } | 549 } |
553 | 550 |
554 Response _getRefactoring(Request request) { | 551 Response _getRefactoring(Request request) { |
555 if (searchEngine == null) { | |
556 return new Response.noIndexGenerated(request); | |
557 } | |
558 if (refactoringManager.hasPendingRequest) { | 552 if (refactoringManager.hasPendingRequest) { |
559 refactoringManager.cancel(); | 553 refactoringManager.cancel(); |
560 _newRefactoringManager(); | 554 _newRefactoringManager(); |
561 } | 555 } |
562 refactoringManager.getRefactoring(request); | 556 refactoringManager.getRefactoring(request); |
563 return Response.DELAYED_RESPONSE; | 557 return Response.DELAYED_RESPONSE; |
564 } | 558 } |
565 | 559 |
566 /** | 560 /** |
567 * Initializes [refactoringManager] with a new instance. | 561 * Initializes [refactoringManager] with a new instance. |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 } | 1076 } |
1083 return new RefactoringStatus(); | 1077 return new RefactoringStatus(); |
1084 } | 1078 } |
1085 } | 1079 } |
1086 | 1080 |
1087 /** | 1081 /** |
1088 * [_RefactoringManager] throws instances of this class internally to stop | 1082 * [_RefactoringManager] throws instances of this class internally to stop |
1089 * processing in a manager that was reset. | 1083 * processing in a manager that was reset. |
1090 */ | 1084 */ |
1091 class _ResetError {} | 1085 class _ResetError {} |
OLD | NEW |