Chromium Code Reviews| 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 4a7ceeda116d9127319550d63cae780680356aea..582d07c7d733a24dac2d200c60959fc2ad2f751b 100644 |
| --- a/pkg/analysis_server/lib/src/context_manager.dart |
| +++ b/pkg/analysis_server/lib/src/context_manager.dart |
| @@ -100,6 +100,28 @@ abstract class ContextManager { |
| void removeContext(Folder folder); |
| /** |
| + * Rebuild the set of contexts from scratch based on the data last sent to |
| + * setRoots(). |
| + */ |
| + void refresh() { |
| + List<Folder> contextFolders = _contexts.keys.toList(); |
| + // destroy old contexts |
| + contextFolders.forEach(_destroyContext); |
| + // create new contexts, but skip any that are contained inside a parent |
| + // context (those will be automatically created upon creation of the |
| + // parent). |
| + for (Folder newFolder in contextFolders) { |
|
scheglov
2014/09/10 01:55:54
With this implementation we trust that we have a v
Paul Berry
2014/09/10 18:26:12
Fair enough. I've reworked things so that we acco
|
| + bool insideAnotherFolder = contextFolders.any((folder) { |
| + return folder.path != newFolder.path && |
| + folder.isOrContains(newFolder.path); |
|
scheglov
2014/09/10 01:55:54
Will folder.contains(newFolder.path) replace both
Paul Berry
2014/09/10 18:26:11
Acknowledged. This code is gone now.
|
| + }); |
| + if (!insideAnotherFolder) { |
| + _createContexts(newFolder, false); |
| + } |
| + } |
| + } |
| + |
| + /** |
| * Change the set of paths which should be used as starting points to |
| * determine the context directories. |
| */ |