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 library edit.domain; | 5 library edit.domain; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
10 import 'package:analysis_server/src/collections.dart'; | 10 import 'package:analysis_server/src/collections.dart'; |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
350 }); | 350 }); |
351 }, onError: (exception, stackTrace) { | 351 }, onError: (exception, stackTrace) { |
352 server.instrumentationService.logException(exception, stackTrace); | 352 server.instrumentationService.logException(exception, stackTrace); |
353 server.sendResponse( | 353 server.sendResponse( |
354 new Response.serverError(request, exception, stackTrace)); | 354 new Response.serverError(request, exception, stackTrace)); |
355 _reset(); | 355 _reset(); |
356 }); | 356 }); |
357 } | 357 } |
358 | 358 |
359 /** | 359 /** |
360 * Awaits for analysis to complete and then calls [_init2] to actually | |
361 * initialize the resfactoring. | |
362 */ | |
363 Future<RefactoringStatus> _init(RefactoringKind kind, String file, int offset, | |
364 int length) { | |
365 return server.onAnalysisComplete.then((_) { | |
Paul Berry
2015/01/26 22:32:11
As we discussed in person, it would be nice in a f
| |
366 return _init2(kind, file, offset, length); | |
367 }); | |
368 } | |
369 | |
370 /** | |
360 * Initializes this context to perform a refactoring with the specified | 371 * Initializes this context to perform a refactoring with the specified |
361 * parameters. The existing [Refactoring] is reused or created as needed. | 372 * parameters. The existing [Refactoring] is reused or created as needed. |
362 */ | 373 */ |
363 Future<RefactoringStatus> _init(RefactoringKind kind, String file, int offset, | 374 Future<RefactoringStatus> _init2(RefactoringKind kind, String file, |
364 int length) { | 375 int offset, int length) { |
365 // check if we can continue with the existing Refactoring instance | 376 // check if we can continue with the existing Refactoring instance |
366 if (this.kind == kind && | 377 if (this.kind == kind && |
367 this.file == file && | 378 this.file == file && |
368 this.offset == offset && | 379 this.offset == offset && |
369 this.length == length) { | 380 this.length == length) { |
370 return new Future.value(initStatus); | 381 return new Future.value(initStatus); |
371 } | 382 } |
372 _reset(); | 383 _reset(); |
373 this.kind = kind; | 384 this.kind = kind; |
374 this.file = file; | 385 this.file = file; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
572 } | 583 } |
573 if (refactoring is RenameRefactoring) { | 584 if (refactoring is RenameRefactoring) { |
574 RenameRefactoring renameRefactoring = refactoring; | 585 RenameRefactoring renameRefactoring = refactoring; |
575 RenameOptions renameOptions = params.options; | 586 RenameOptions renameOptions = params.options; |
576 renameRefactoring.newName = renameOptions.newName; | 587 renameRefactoring.newName = renameOptions.newName; |
577 return renameRefactoring.checkNewName(); | 588 return renameRefactoring.checkNewName(); |
578 } | 589 } |
579 return new RefactoringStatus(); | 590 return new RefactoringStatus(); |
580 } | 591 } |
581 } | 592 } |
OLD | NEW |