Chromium Code Reviews| 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 241b9f16b9716373d7952893ceb73eff5f24a697..30072a742b177170cdc50d26a226ec03b8b18c37 100644 |
| --- a/pkg/analysis_server/lib/src/context_manager.dart |
| +++ b/pkg/analysis_server/lib/src/context_manager.dart |
| @@ -13,6 +13,7 @@ import 'package:analysis_server/src/source/optimizing_pub_package_map_provider.d |
| 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/analysis_options_provider.dart'; |
| import 'package:analyzer/source/package_map_resolver.dart'; |
| import 'package:analyzer/source/path_filter.dart'; |
| import 'package:analyzer/src/generated/engine.dart'; |
| @@ -21,6 +22,7 @@ import 'package:analyzer/src/generated/source.dart'; |
| import 'package:analyzer/src/generated/source_io.dart'; |
| import 'package:path/path.dart' as pathos; |
| import 'package:watcher/watcher.dart'; |
| +import 'package:yaml/yaml.dart'; |
| /** |
| * Class that maintains a mapping from included/excluded paths to a set of |
| @@ -94,12 +96,16 @@ abstract class AbstractContextManager implements ContextManager { |
| */ |
| final OptimizingPubPackageMapProvider _packageMapProvider; |
| + /// Provider of analysis options. |
| + AnalysisOptionsProvider analysisOptionsProvider = |
| + new AnalysisOptionsProvider(); |
| + |
| /** |
| * The instrumentation service used to report instrumentation data. |
| */ |
| final InstrumentationService _instrumentationService; |
| - AbstractContextManager(this.resourceProvider, this.packageResolverProvider, |
| + AbstractContextManager(this.resourceProvider,this.packageResolverProvider, |
| this._packageMapProvider, this._instrumentationService) { |
| pathContext = resourceProvider.pathContext; |
| } |
| @@ -164,7 +170,7 @@ abstract class AbstractContextManager implements ContextManager { |
| // Do nothing. |
| } |
| - // Sets the [ignorePatterns] for the context [folder]. |
| + /// Sets the [ignorePatterns] for the context [folder]. |
| void setIgnorePatternsForContext(Folder folder, List<String> ignorePatterns) { |
| _ContextInfo info = _contexts[folder]; |
| if (info == null) { |
| @@ -174,6 +180,25 @@ abstract class AbstractContextManager implements ContextManager { |
| pathFilter.setIgnorePatterns(ignorePatterns); |
| } |
| + /// Process [options] for the context [folder]. |
| + void processOptionsForContext(Folder folder, Map<String, YamlNode> options) { |
| + _ContextInfo info = _contexts[folder]; |
| + if (info == null) { |
| + return; |
| + } |
| + YamlMap analyzer = options['analyzer']; |
| + if (analyzer == null) { |
| + // No options for analyzer. |
| + return; |
| + } |
| + |
| + // Set ignore patterns. |
| + YamlList ignore = analyzer['ignore']; |
|
Brian Wilkerson
2015/07/17 21:03:22
"ignore" --> "exclude"
Cutch
2015/07/17 21:09:40
Done.
|
| + if (ignore != null) { |
| + setIgnorePatternsForContext(folder, ignore); |
| + } |
| + } |
| + |
| @override |
| bool isInAnalysisRoot(String path) { |
| // check if excluded |
| @@ -490,6 +515,12 @@ abstract class AbstractContextManager implements ContextManager { |
| _ContextInfo info = new _ContextInfo( |
| folder, pubspecFile, children, normalizedPackageRoots[folder.path]); |
| _contexts[folder] = info; |
| + try { |
| + var options = analysisOptionsProvider.getOptions(folder); |
| + processOptionsForContext(folder, options); |
| + } catch (_) { |
| + rethrow; |
|
Brian Wilkerson
2015/07/17 21:03:22
Is there a reason to catch the exception if we're
Cutch
2015/07/17 21:09:41
The analyzer tells me I need to have a catch or fi
Brian Wilkerson
2015/07/17 21:11:53
Ok. I'll re-phrase. Why do you want a try block he
Cutch
2015/07/17 21:13:16
Sorry, I was being dense. I now understand your or
Brian Wilkerson
2015/07/17 21:14:25
No problem. A follow-up CL will work.
|
| + } |
| info.changeSubscription = folder.changes.listen((WatchEvent event) { |
| _handleWatchEvent(folder, info, event); |
| }); |