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

Unified Diff: pkg/analysis_server/lib/src/edit/edit_domain.dart

Issue 875163002: Make AnalysisServer.onAnalysisComplete a Future and wait for it before refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/edit/edit_domain.dart
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index 70ce1d33a3772decb59516f7a2395fa70e4e6d9b..26e3ff728abe8fb0b1397d267e38cb9fc4204e4c 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -357,11 +357,22 @@ class _RefactoringManager {
}
/**
- * Initializes this context to perform a refactoring with the specified
- * parameters. The existing [Refactoring] is reused or created as needed.
+ * Awaits for analysis to complete and then calls [_init2] to actually
+ * initialize the resfactoring.
*/
Future<RefactoringStatus> _init(RefactoringKind kind, String file, int offset,
int length) {
+ return server.onAnalysisComplete.then((_) {
+ return _init2(kind, file, offset, length);
+ });
+ }
+
+ /**
+ * Initializes this context to perform a refactoring with the specified
+ * parameters. The existing [Refactoring] is reused or created as needed.
+ */
+ Future<RefactoringStatus> _init2(RefactoringKind kind, String file,
+ int offset, int length) {
// check if we can continue with the existing Refactoring instance
if (this.kind == kind &&
this.file == file &&

Powered by Google App Engine
This is Rietveld 408576698