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 7c167f942cfcada298fbb2b04d4beb993a9de241..ac89d203302ab75a03bbd737ef1235eb694417e7 100644 |
| --- a/pkg/analysis_server/lib/src/context_manager.dart |
| +++ b/pkg/analysis_server/lib/src/context_manager.dart |
| @@ -312,6 +312,11 @@ abstract class ContextManagerCallbacks { |
| */ |
| class ContextManagerImpl implements ContextManager { |
| /** |
| + * The name of the `doc` directory. |
| + */ |
| + static const String DOC_DIR_NAME = 'doc'; |
| + |
| + /** |
| * The name of the `lib` directory. |
| */ |
| static const String LIB_DIR_NAME = 'lib'; |
| @@ -687,7 +692,9 @@ class ContextManagerImpl implements ContextManager { |
| * Recursively adds all Dart and HTML files to the [changeSet]. |
| */ |
| void _addSourceFiles(ChangeSet changeSet, Folder folder, ContextInfo info) { |
| - if (info.excludesResource(folder) || folder.shortName.startsWith('.')) { |
| + if (info.excludesResource(folder) || |
| + folder.shortName.startsWith('.') || |
| + folder.shortName == DOC_DIR_NAME) { |
|
Brian Wilkerson
2015/11/11 19:27:16
Do we really want to exclude all directories named
|
| return; |
| } |
| List<Resource> children = null; |
| @@ -1045,7 +1052,10 @@ class ContextManagerImpl implements ContextManager { |
| _recomputeFolderDisposition(info); |
| } |
| // maybe excluded globally |
| - if (_isExcluded(path) || _isContainedInDotFolder(info.folder.path, path)) { |
| + if (_isExcluded(path) || |
| + _isContainedInDotFolder(info.folder.path, path) || |
| + _isInPackagesDir(info.folder.path, path) || |
| + _isInDocDir(info.folder.path, path)) { |
| return; |
| } |
| // maybe excluded from the context, so other context will handle it |
| @@ -1058,10 +1068,6 @@ class ContextManagerImpl implements ContextManager { |
| // handle the change |
| switch (event.type) { |
| case ChangeType.ADD: |
| - if (_isInPackagesDir(path, info.folder)) { |
| - return; |
| - } |
| - |
| Resource resource = resourceProvider.getResource(path); |
| String directoryPath = pathContext.dirname(path); |
| @@ -1197,11 +1203,21 @@ class ContextManagerImpl implements ContextManager { |
| } |
| /** |
| - * Determine if the path from [folder] to [path] contains a 'packages' |
| - * directory. |
| + * Determine whether the given [path], when interpreted relative to the |
| + * context root [root], contains a 'doc' folder. |
| + */ |
| + bool _isInDocDir(String root, String path) { |
| + String relativePath = pathContext.relative(path, from: root); |
| + List<String> pathParts = pathContext.split(relativePath); |
| + return pathParts.contains(DOC_DIR_NAME); |
| + } |
| + |
| + /** |
| + * Determine whether the given [path], when interpreted relative to the |
| + * context root [root], contains a 'packages' folder. |
| */ |
| - bool _isInPackagesDir(String path, Folder folder) { |
| - String relativePath = pathContext.relative(path, from: folder.path); |
| + bool _isInPackagesDir(String root, String path) { |
| + String relativePath = pathContext.relative(path, from: root); |
| List<String> pathParts = pathContext.split(relativePath); |
| return pathParts.contains(PACKAGES_NAME); |
| } |