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

Unified Diff: pkg/analysis_server/lib/src/context_manager.dart

Issue 1234293003: Make analysis_server use ignore patterns from .analysis_options file (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..40103139244b490dd0b78c55a0f3f788fabeb0a8 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,6 +96,10 @@ abstract class AbstractContextManager implements ContextManager {
*/
final OptimizingPubPackageMapProvider _packageMapProvider;
+ /// Provider of analysis options.
+ AnalysisOptionsProvider analysisOptionsProvider =
+ new AnalysisOptionsProvider();
+
/**
* The instrumentation service used to report instrumentation data.
*/
@@ -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 exclude = analyzer['exclude'];
+ if (exclude != null) {
+ setIgnorePatternsForContext(folder, exclude);
+ }
+ }
+
@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;
+ }
info.changeSubscription = folder.changes.listen((WatchEvent event) {
_handleWatchEvent(folder, info, event);
});
« 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