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

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

Issue 1047733004: Support refresh of individual analysis roots (issue 22254) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address more comments Created 5 years, 9 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 | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/lib/src/context_manager.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/lib/src/context_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698