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

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: 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
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..62a6ce76a5a1a4451d5457224f1f459461d3d2e8 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -164,12 +164,24 @@ abstract class ContextManager {
/**
* 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);

Powered by Google App Engine
This is Rietveld 408576698