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

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

Issue 880313006: Disable analysis in hidden directories (fix for issue 22170) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 5 years, 10 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 | Annotate | Revision Log
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 9
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 276 }
277 _addPreviouslyExcludedSources(info, changeSet, child, oldExcludedPaths); 277 _addPreviouslyExcludedSources(info, changeSet, child, oldExcludedPaths);
278 } 278 }
279 } 279 }
280 } 280 }
281 281
282 /** 282 /**
283 * Resursively adds all Dart and HTML files to the [changeSet]. 283 * Resursively adds all Dart and HTML files to the [changeSet].
284 */ 284 */
285 void _addSourceFiles(ChangeSet changeSet, Folder folder, _ContextInfo info) { 285 void _addSourceFiles(ChangeSet changeSet, Folder folder, _ContextInfo info) {
286 if (info.excludesResource(folder)) { 286 if (info.excludesResource(folder) || folder.shortName.startsWith('.')) {
287 return; 287 return;
288 } 288 }
289 List<Resource> children = folder.getChildren(); 289 List<Resource> children = folder.getChildren();
290 for (Resource child in children) { 290 for (Resource child in children) {
291 String path = child.path; 291 String path = child.path;
292 // ignore excluded files or folders 292 // ignore excluded files or folders
293 if (_isExcluded(path)) { 293 if (_isExcluded(path)) {
294 continue; 294 continue;
295 } 295 }
296 // add files, recurse into folders 296 // add files, recurse into folders
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 /** 655 /**
656 * Returns `true` if [path] is excluded, as it is in one of the children. 656 * Returns `true` if [path] is excluded, as it is in one of the children.
657 */ 657 */
658 bool excludes(String path) { 658 bool excludes(String path) {
659 return children.any((child) { 659 return children.any((child) {
660 return child.folder.contains(path); 660 return child.folder.contains(path);
661 }); 661 });
662 } 662 }
663 663
664 /** 664 /**
665 * Returns `true` if [resource] is excldued, as it is in one of the children. 665 * Returns `true` if [resource] is excluded, as it is in one of the children.
666 */ 666 */
667 bool excludesResource(Resource resource) { 667 bool excludesResource(Resource resource) {
668 return excludes(resource.path); 668 return excludes(resource.path);
669 } 669 }
670 670
671 /** 671 /**
672 * Returns `true` if [path] is the pubspec file of this context. 672 * Returns `true` if [path] is the pubspec file of this context.
673 */ 673 */
674 bool isPubspec(String path) { 674 bool isPubspec(String path) {
675 return path == pubspecPath; 675 return path == pubspecPath;
676 } 676 }
677 } 677 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698