@@ -87,15 +87,9 @@ abstract class ContextManager {
8787 /// If no driver contains the given path, `null` is returned.
8888 AnalysisDriver getDriverFor (String path);
8989
90- /// Determine whether the given [path] , when interpreted relative to innermost
91- /// context root, contains a folder whose name starts with '.'.
92- ///
93- /// TODO(scheglov) Remove it, just [isInAnalysisRoot] should be enough.
94- bool isContainedInDotFolder (String path);
95-
96- /// Return `true` if the given absolute [path] is in one of the current
97- /// root folders and is not excluded.
98- bool isInAnalysisRoot (String path);
90+ /// Return `true` if the file or directory with the given [path] will be
91+ /// analyzed in one of the analysis contexts.
92+ bool isAnalyzed (String path);
9993
10094 /// Rebuild the set of contexts from scratch based on the data last sent to
10195 /// [setRoots] .
@@ -221,21 +215,8 @@ class ContextManagerImpl implements ContextManager {
221215 return getContextFor (path)? .driver;
222216 }
223217
224- /// Determine whether the given [path] , when interpreted relative to innermost
225- /// context root, contains a folder whose name starts with '.'.
226- @override
227- bool isContainedInDotFolder (String path) {
228- for (var analysisContext in _collection.contexts) {
229- var contextImpl = analysisContext as DriverBasedAnalysisContext ;
230- if (_isContainedInDotFolder (contextImpl.contextRoot.root.path, path)) {
231- return true ;
232- }
233- }
234- return false ;
235- }
236-
237218 @override
238- bool isInAnalysisRoot (String path) {
219+ bool isAnalyzed (String path) {
239220 var collection = _collection;
240221 if (collection == null ) {
241222 return false ;
@@ -431,9 +412,6 @@ class ContextManagerImpl implements ContextManager {
431412 _watchBazelFilesIfNeeded (rootFolder, driver);
432413
433414 for (var file in contextImpl.contextRoot.analyzedFiles ()) {
434- if (_isContainedInDotFolder (contextImpl.contextRoot.root.path, file)) {
435- continue ;
436- }
437415 if (file_paths.isAndroidManifestXml (pathContext, file)) {
438416 _analyzeAndroidManifestXml (driver, file);
439417 } else if (file_paths.isDart (pathContext, file)) {
@@ -554,12 +532,11 @@ class ContextManagerImpl implements ContextManager {
554532 var analysisContext = analysisContext_ as DriverBasedAnalysisContext ;
555533 switch (type) {
556534 case ChangeType .ADD :
557- // TODO(scheglov) Why not `isInAnalysisRoot()`?
558- if ( _isContainedInDotFolder (
559- analysisContext.contextRoot.root.path, path)) {
560- return ;
535+ if (analysisContext.contextRoot. isAnalyzed (path)) {
536+ analysisContext.driver. addFile (path);
537+ } else {
538+ analysisContext.driver. changeFile (path) ;
561539 }
562- analysisContext.driver.addFile (path);
563540 break ;
564541 case ChangeType .MODIFY :
565542 analysisContext.driver.changeFile (path);
@@ -592,25 +569,6 @@ class ContextManagerImpl implements ContextManager {
592569 refresh ();
593570 }
594571
595- /// Determine whether the given [path] , when interpreted relative to the
596- /// context root [root] , contains a folder whose name starts with '.' but is
597- /// not included in [exclude] .
598- bool _isContainedInDotFolder (String root, String path,
599- {Set <String > exclude}) {
600- var pathDir = pathContext.dirname (path);
601- var rootPrefix = root + pathContext.separator;
602- if (pathDir.startsWith (rootPrefix)) {
603- var suffixPath = pathDir.substring (rootPrefix.length);
604- for (var pathComponent in pathContext.split (suffixPath)) {
605- if (pathComponent.startsWith ('.' ) &&
606- ! (exclude? .contains (pathComponent) ?? false )) {
607- return true ;
608- }
609- }
610- }
611- return false ;
612- }
613-
614572 /// Read the contents of the file at the given [path] , or throw an exception
615573 /// if the contents cannot be read.
616574 String _readFile (String path) {
0 commit comments