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

Unified Diff: pkg/analysis_server/lib/src/context_manager.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/lib/src/analysis_server.dart ('k') | pkg/analysis_server/lib/src/domain_analysis.dart » ('j') | 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 c76ac5e9b43cd9ce02feba13ef84b47dc072c209..b52f6ad93cea4704370cb076b3b846b12045b908 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -163,13 +163,39 @@ abstract class ContextManager {
}
/**
+ * Return a list containing all of the contexts contained in the given
+ * [analysisRoot].
+ */
+ List<AnalysisContext> contextsInAnalysisRoot(Folder analysisRoot) {
+ List<AnalysisContext> contexts = <AnalysisContext>[];
+ _contexts.forEach((Folder contextFolder, _ContextInfo info) {
+ if (analysisRoot.isOrContains(contextFolder.path)) {
+ contexts.add(info.context);
+ }
+ });
+ return contexts;
+ }
+
+ /**
* Rebuild the set of contexts from scratch based on the data last sent to
- * setRoots().
+ * setRoots(). Only contexts contained in the given list of analysis [roots]
+ * will be rebuilt, unless the list is `null`, in which case every context
+ * will be rebuilt.
*/
- void refresh() {
+ void refresh(List<Resource> roots) {
// Destroy old contexts
List<Folder> contextFolders = _contexts.keys.toList();
- contextFolders.forEach(_destroyContext);
+ if (roots == null) {
+ contextFolders.forEach(_destroyContext);
+ } else {
+ roots.forEach((Resource resource) {
+ contextFolders.forEach((Folder contextFolder) {
+ if (resource is Folder && resource.isOrContains(contextFolder.path)) {
+ _destroyContext(contextFolder);
+ }
+ });
+ });
+ }
// Rebuild contexts based on the data last sent to setRoots().
setRoots(includedPaths, excludedPaths, packageRoots);
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_server/lib/src/domain_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698