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

Unified Diff: pkg/analysis_server/lib/src/context_manager.dart

Issue 1188663006: watch for file system changes after context created (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/context_manager.dart
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index bfa8cb6fbd0c7fd383aefbde12a7d6ab2d3be71c..3abc54de15ab441685f44dff9ac57ce8f835edc8 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -444,12 +444,15 @@ abstract class ContextManager {
_ContextInfo info = new _ContextInfo(
folder, pubspecFile, children, normalizedPackageRoots[folder.path]);
_contexts[folder] = info;
- info.changeSubscription = folder.changes.listen((WatchEvent event) {
- _handleWatchEvent(folder, info, event);
- });
UriResolver packageUriResolver = _computePackageUriResolver(folder, info);
info.context = addContext(folder, packageUriResolver);
info.context.name = folder.path;
+ // Subscribe to file changes after context has been set
+ // so that no changes will be received before we have a context
+ // (e.g. _computePackageUriResolver throws an exception)
Paul Berry 2015/06/18 20:24:42 I don't understand why this is necessary. Subscri
danrubel 2015/06/22 11:22:56 Good point. Per discussion I reworked this to add
+ info.changeSubscription = folder.changes.listen((WatchEvent event) {
+ _handleWatchEvent(folder, info, event);
+ });
return info;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698