Chromium Code Reviews| Index: pkg/analysis_server/lib/src/analysis_server.dart |
| diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart |
| index bad954c6c7ac1dccaaf732881d9474235c815967..906429badf7959cf1cdd4ad5c28d632040f904a8 100644 |
| --- a/pkg/analysis_server/lib/src/analysis_server.dart |
| +++ b/pkg/analysis_server/lib/src/analysis_server.dart |
| @@ -733,14 +733,21 @@ class AnalysisServer { |
| } |
| /** |
| - * Trigger reanalysis of all files from disk. |
| + * Trigger reanalysis of all files in the given list of analysis [roots], or |
| + * everything if the analysis roots is `null`. |
| */ |
| - void reanalyze() { |
| + void reanalyze(List<Resource> roots) { |
| // Clear any operations that are pending. |
| - operationQueue.clear(); |
| + if (roots == null) { |
| + operationQueue.clear(); |
| + } else { |
| + for (AnalysisContext context in _getContexts(roots)) { |
| + operationQueue.contextRemoved(context); |
| + } |
| + } |
| // Instruct the contextDirectoryManager to rebuild all contexts from |
| // scratch. |
| - contextDirectoryManager.refresh(); |
| + contextDirectoryManager.refresh(roots); |
| } |
| /** |
| @@ -1096,6 +1103,21 @@ class AnalysisServer { |
| } |
| /** |
| + * Return a set of contexts containing all of the resources in the given list |
| + * of [resources]. |
| + */ |
| + Set<AnalysisContext> _getContexts(List<Resource> resources) { |
| + Set<AnalysisContext> contexts = new HashSet<AnalysisContext>(); |
| + resources.forEach((Resource resource) { |
| + AnalysisContext context = getContainingContext(resource.path); |
|
scheglov
2015/03/30 20:38:07
There might be more that one context in a root.
I
Brian Wilkerson
2015/03/30 21:01:25
Yes, of course. I was thinking backward.
|
| + if (context != null) { |
| + contexts.add(context); |
| + } |
| + }); |
| + return contexts; |
| + } |
| + |
| + /** |
| * Returns the [CompilationUnit] of the Dart file with the given [source] that |
| * should be used to resend notifications for already resolved unit. |
| * Returns `null` if the file is not a part of any context, library has not |