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

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

Issue 2463903002: Simplify handling of watch events for the new analysis driver. (Closed)
Patch Set: Created 4 years, 1 month 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 59376dde8d8a400d8a931319921d96bdcba0fda2..a543ad544f563953181d4076aad4b806882c3eea 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -1379,11 +1379,15 @@ class ContextManagerImpl implements ContextManager {
if (resource is File) {
File file = resource;
if (_shouldFileBeAnalyzed(file)) {
- ChangeSet changeSet = new ChangeSet();
- Source source = createSourceInContext(info.context, file);
- changeSet.addedSource(source);
- callbacks.applyChangesToContext(info.folder, changeSet);
- info.sources[path] = source;
+ if (enableNewAnalysisDriver) {
+ info.analysisDriver.addFile(path);
+ } else {
+ ChangeSet changeSet = new ChangeSet();
+ Source source = createSourceInContext(info.context, file);
+ changeSet.addedSource(source);
+ callbacks.applyChangesToContext(info.folder, changeSet);
+ info.sources[path] = source;
+ }
}
}
break;
@@ -1420,24 +1424,32 @@ class ContextManagerImpl implements ContextManager {
}
}
- List<Source> sources = info.context.getSourcesWithFullName(path);
- if (!sources.isEmpty) {
- ChangeSet changeSet = new ChangeSet();
- sources.forEach((Source source) {
- changeSet.removedSource(source);
- });
- callbacks.applyChangesToContext(info.folder, changeSet);
- info.sources.remove(path);
+ if (enableNewAnalysisDriver) {
+ info.analysisDriver.removeFile(path);
+ } else {
+ List<Source> sources = info.context.getSourcesWithFullName(path);
+ if (!sources.isEmpty) {
+ ChangeSet changeSet = new ChangeSet();
+ sources.forEach((Source source) {
+ changeSet.removedSource(source);
+ });
+ callbacks.applyChangesToContext(info.folder, changeSet);
+ info.sources.remove(path);
+ }
}
break;
case ChangeType.MODIFY:
- List<Source> sources = info.context.getSourcesWithFullName(path);
- if (!sources.isEmpty) {
- ChangeSet changeSet = new ChangeSet();
- sources.forEach((Source source) {
- changeSet.changedSource(source);
- });
- callbacks.applyChangesToContext(info.folder, changeSet);
+ if (enableNewAnalysisDriver) {
+ info.analysisDriver.changeFile(path);
+ } else {
+ List<Source> sources = info.context.getSourcesWithFullName(path);
+ if (!sources.isEmpty) {
+ ChangeSet changeSet = new ChangeSet();
+ sources.forEach((Source source) {
+ changeSet.changedSource(source);
+ });
+ callbacks.applyChangesToContext(info.folder, changeSet);
+ }
}
break;
}
« 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