| 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..1630a63a7f519348b07d49a3628e8fee326ffd3e 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,20 @@ 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) {
|
| + if (resource is Folder) {
|
| + contexts.addAll(contextDirectoryManager.contextsInAnalysisRoot(resource));
|
| + }
|
| + });
|
| + 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
|
|
|