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

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

Issue 452303002: Always ignore 'packages' folders. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | « no previous file | no next file » | 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 3333a0c0929e90eb3b49858a66c84db22391fe4e..13ff886629ceae96397b1e512c1d6d1783b2b3dc 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -22,6 +22,12 @@ const String PUBSPEC_NAME = 'pubspec.yaml';
/**
+ * The name of `packages` folders.
+ */
+const String PACKAGES_NAME = 'packages';
+
+
+/**
* Class that maintains a mapping from included/excluded paths to a set of
* folders that should correspond to analysis contexts.
*/
@@ -192,9 +198,7 @@ abstract class ContextManager {
info.sources[path] = source;
}
} else if (child is Folder) {
- if (child.shortName == 'packages') {
- // TODO(paulberry): perhaps we should only skip packages dirs if
- // there is a pubspec.yaml?
+ if (child.shortName == PACKAGES_NAME) {
continue;
}
_addPreviouslyExcludedSources(info, changeSet, child, oldExcludedPaths);
@@ -224,9 +228,7 @@ abstract class ContextManager {
info.sources[path] = source;
}
} else if (child is Folder) {
- if (child.shortName == 'packages') {
- // TODO(paulberry): perhaps we should only skip packages dirs if
- // there is a pubspec.yaml?
+ if (child.shortName == PACKAGES_NAME) {
continue;
}
_addSourceFiles(changeSet, child, info);
@@ -361,9 +363,7 @@ abstract class ContextManager {
switch (event.type) {
case ChangeType.ADD:
if (_isInPackagesDir(path, folder)) {
- // TODO(paulberry): perhaps we should only skip packages dirs if
- // there is a pubspec.yaml?
- break;
+ return;
}
Resource resource = resourceProvider.getResource(path);
// pubspec was added in a sub-folder, extract a new context
@@ -447,12 +447,7 @@ abstract class ContextManager {
bool _isInPackagesDir(String path, Folder folder) {
String relativePath = pathContext.relative(path, from: folder.path);
List<String> pathParts = pathContext.split(relativePath);
- for (int i = 0; i < pathParts.length - 1; i++) {
- if (pathParts[i] == 'packages') {
- return true;
- }
- }
- return false;
+ return pathParts.contains(PACKAGES_NAME);
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698