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

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

Issue 2842013003: Add support for watch events and error notifications (Closed)
Patch Set: fix comment Created 3 years, 8 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/context_manager.dart
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 686c08898d24f226190dcf4272edc50107a1d5a3..096e4a6936673c67c2b1943b33b604011efecfae 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -386,6 +386,11 @@ abstract class ContextManagerCallbacks {
void applyFileRemoved(AnalysisDriver driver, String file);
/**
+ * Sent the given watch [event] to any interested plugins.
+ */
+ void broadcastWatchEvent(WatchEvent event);
+
+ /**
* Signals that the context manager has started to compute a package map (if
* [computing] is `true`) or has finished (if [computing] is `false`).
*/
@@ -1395,7 +1400,10 @@ class ContextManagerImpl implements ContextManager {
// but implicitly referenced in another context, we will only send a
// changeSet to the context that explicitly includes the file (because
// that's the only context that's watching the file).
- ContextInfo info = _getInnermostContextInfoFor(event.path);
+ callbacks.broadcastWatchEvent(event);
+ String path = event.path;
+ ChangeType type = event.type;
+ ContextInfo info = _getInnermostContextInfoFor(path);
if (info == null) {
// This event doesn't apply to any context. This could happen due to a
// race condition (e.g. a context was removed while one of its events was
@@ -1403,8 +1411,7 @@ class ContextManagerImpl implements ContextManager {
return;
}
_instrumentationService.logWatchEvent(
- info.folder.path, event.path, event.type.toString());
- String path = event.path;
+ info.folder.path, path, type.toString());
// First handle changes that affect folderDisposition (since these need to
// be processed regardless of whether they are part of an excluded/ignored
// path).
@@ -1426,7 +1433,7 @@ class ContextManagerImpl implements ContextManager {
return;
}
// handle the change
- switch (event.type) {
+ switch (type) {
case ChangeType.ADD:
Resource resource = resourceProvider.getResource(path);
@@ -1543,7 +1550,7 @@ class ContextManagerImpl implements ContextManager {
break;
}
_checkForPackagespecUpdate(path, info, info.folder);
- _checkForAnalysisOptionsUpdate(path, info, event.type);
+ _checkForAnalysisOptionsUpdate(path, info, type);
}
/**

Powered by Google App Engine
This is Rietveld 408576698