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

Side by Side Diff: pkg/analysis_server/lib/src/context_manager.dart

Issue 1372173004: Ignore added files in hidden directories. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library context.directory.manager; 5 library context.directory.manager;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:core' hide Resource; 10 import 'dart:core' hide Resource;
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 _instrumentationService.logWatchEvent( 1003 _instrumentationService.logWatchEvent(
1004 info.folder.path, event.path, event.type.toString()); 1004 info.folder.path, event.path, event.type.toString());
1005 String path = event.path; 1005 String path = event.path;
1006 // First handle changes that affect folderDisposition (since these need to 1006 // First handle changes that affect folderDisposition (since these need to
1007 // be processed regardless of whether they are part of an excluded/ignored 1007 // be processed regardless of whether they are part of an excluded/ignored
1008 // path). 1008 // path).
1009 if (info.hasDependency(path)) { 1009 if (info.hasDependency(path)) {
1010 _recomputeFolderDisposition(info); 1010 _recomputeFolderDisposition(info);
1011 } 1011 }
1012 // maybe excluded globally 1012 // maybe excluded globally
1013 if (_isExcluded(path)) { 1013 if (_isExcluded(path) || _isContainedInDotFolder(info.folder.path, path)) {
1014 return; 1014 return;
1015 } 1015 }
1016 // maybe excluded from the context, so other context will handle it 1016 // maybe excluded from the context, so other context will handle it
1017 if (info.excludes(path)) { 1017 if (info.excludes(path)) {
1018 return; 1018 return;
1019 } 1019 }
1020 if (info.ignored(path)) { 1020 if (info.ignored(path)) {
1021 return; 1021 return;
1022 } 1022 }
1023 // handle the change 1023 // handle the change
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 callbacks.applyChangesToContext(info.folder, changeSet); 1139 callbacks.applyChangesToContext(info.folder, changeSet);
1140 } 1140 }
1141 break; 1141 break;
1142 } 1142 }
1143 1143
1144 //TODO(pquitslund): find the right place for this 1144 //TODO(pquitslund): find the right place for this
1145 _checkForPackagespecUpdate(path, info, info.folder); 1145 _checkForPackagespecUpdate(path, info, info.folder);
1146 } 1146 }
1147 1147
1148 /** 1148 /**
1149 * Determine whether the given [path], when interpreted relative to the
1150 * context root [root], contains a folder whose name starts with '.'.
1151 */
1152 bool _isContainedInDotFolder(String root, String path) {
1153 String relativePath =
1154 pathContext.relative(pathContext.dirname(path), from: root);
1155 for (String pathComponent in pathContext.split(relativePath)) {
1156 if (pathComponent.startsWith('.') &&
1157 pathComponent != '.' &&
1158 pathComponent != '..') {
1159 return true;
1160 }
1161 }
1162 return false;
1163 }
1164
1165 /**
1149 * Returns `true` if the given [path] is excluded by [excludedPaths]. 1166 * Returns `true` if the given [path] is excluded by [excludedPaths].
1150 */ 1167 */
1151 bool _isExcluded(String path) => _isExcludedBy(excludedPaths, path); 1168 bool _isExcluded(String path) => _isExcludedBy(excludedPaths, path);
1152 1169
1153 /** 1170 /**
1154 * Returns `true` if the given [path] is excluded by [excludedPaths]. 1171 * Returns `true` if the given [path] is excluded by [excludedPaths].
1155 */ 1172 */
1156 bool _isExcludedBy(List<String> excludedPaths, String path) { 1173 bool _isExcludedBy(List<String> excludedPaths, String path) {
1157 return excludedPaths.any((excludedPath) { 1174 return excludedPaths.any((excludedPath) {
1158 if (pathContext.isWithin(excludedPath, path)) { 1175 if (pathContext.isWithin(excludedPath, path)) {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 var path = resourceProvider.pathContext.fromUri(uri); 1421 var path = resourceProvider.pathContext.fromUri(uri);
1405 packageMap[name] = <Folder>[resourceProvider.getFolder(path)]; 1422 packageMap[name] = <Folder>[resourceProvider.getFolder(path)];
1406 } 1423 }
1407 }); 1424 });
1408 return <UriResolver>[new SdkExtUriResolver(packageMap)]; 1425 return <UriResolver>[new SdkExtUriResolver(packageMap)];
1409 } else { 1426 } else {
1410 return const <UriResolver>[]; 1427 return const <UriResolver>[];
1411 } 1428 }
1412 } 1429 }
1413 } 1430 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698