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

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: Use Completer instead of busy loop 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
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/test/analysis_abstract.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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((_) {
Paul Berry 2015/01/26 22:32:11 As we discussed in person, it would be nice in a f
+ 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 &&
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/test/analysis_abstract.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698