| 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 fc93e96ec3b5d302ee074d6c356ed0a982353e09..241b9f16b9716373d7952893ceb73eff5f24a697 100644
|
| --- a/pkg/analysis_server/lib/src/context_manager.dart
|
| +++ b/pkg/analysis_server/lib/src/context_manager.dart
|
| @@ -14,6 +14,7 @@ import 'package:analysis_server/uri/resolver_provider.dart';
|
| import 'package:analyzer/file_system/file_system.dart';
|
| import 'package:analyzer/instrumentation/instrumentation.dart';
|
| import 'package:analyzer/source/package_map_resolver.dart';
|
| +import 'package:analyzer/source/path_filter.dart';
|
| import 'package:analyzer/src/generated/engine.dart';
|
| import 'package:analyzer/src/generated/java_io.dart';
|
| import 'package:analyzer/src/generated/source.dart';
|
| @@ -163,6 +164,16 @@ abstract class AbstractContextManager implements ContextManager {
|
| // Do nothing.
|
| }
|
|
|
| + // Sets the [ignorePatterns] for the context [folder].
|
| + void setIgnorePatternsForContext(Folder folder, List<String> ignorePatterns) {
|
| + _ContextInfo info = _contexts[folder];
|
| + if (info == null) {
|
| + return;
|
| + }
|
| + var pathFilter = info.pathFilter;
|
| + pathFilter.setIgnorePatterns(ignorePatterns);
|
| + }
|
| +
|
| @override
|
| bool isInAnalysisRoot(String path) {
|
| // check if excluded
|
| @@ -318,6 +329,10 @@ abstract class AbstractContextManager implements ContextManager {
|
| }
|
| for (Resource child in children) {
|
| String path = child.path;
|
| + // Path is being ignored.
|
| + if (info.ignored(path)) {
|
| + continue;
|
| + }
|
| // add files, recurse into folders
|
| if (child is File) {
|
| // ignore if should not be analyzed at all
|
| @@ -361,7 +376,7 @@ abstract class AbstractContextManager implements ContextManager {
|
| for (Resource child in children) {
|
| String path = child.path;
|
| // ignore excluded files or folders
|
| - if (_isExcluded(path) || info.excludes(path)) {
|
| + if (_isExcluded(path) || info.excludes(path) || info.ignored(path)) {
|
| continue;
|
| }
|
| // add files, recurse into folders
|
| @@ -606,6 +621,9 @@ abstract class AbstractContextManager implements ContextManager {
|
| if (info.excludes(path)) {
|
| return;
|
| }
|
| + if (info.ignored(path)) {
|
| + return;
|
| + }
|
| // handle the change
|
| switch (event.type) {
|
| case ChangeType.ADD:
|
| @@ -859,6 +877,9 @@ class _ContextInfo {
|
| */
|
| final Folder folder;
|
|
|
| + /// The [PathFilter] used to filter sources from being analyzed.
|
| + final PathFilter pathFilter;
|
| +
|
| /**
|
| * The enclosed pubspec-based contexts.
|
| */
|
| @@ -910,7 +931,9 @@ class _ContextInfo {
|
| */
|
| OptimizingPubPackageMapInfo packageMapInfo;
|
|
|
| - _ContextInfo(this.folder, File pubspecFile, this.children, this.packageRoot) {
|
| + _ContextInfo(Folder folder, File pubspecFile, this.children, this.packageRoot)
|
| + : folder = folder,
|
| + pathFilter = new PathFilter(folder.path, null) {
|
| pubspecPath = pubspecFile.path;
|
| for (_ContextInfo child in children) {
|
| child.parent = this;
|
| @@ -931,6 +954,9 @@ class _ContextInfo {
|
| });
|
| }
|
|
|
| + /// Returns `true` if [path] should be ignored.
|
| + bool ignored(String path) => pathFilter.ignored(path);
|
| +
|
| /**
|
| * Returns `true` if [resource] is excluded, as it is in one of the children.
|
| */
|
|
|