| OLD | NEW |
| 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 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:core' hide Resource; | 10 import 'dart:core' hide Resource; |
| 11 | 11 |
| 12 import 'package:analysis_server/plugin/analysis/resolver_provider.dart'; | 12 import 'package:analysis_server/plugin/analysis/resolver_provider.dart'; |
| 13 import 'package:analysis_server/src/analysis_server.dart'; | 13 import 'package:analysis_server/src/analysis_server.dart'; |
| 14 import 'package:analyzer/file_system/file_system.dart'; | 14 import 'package:analyzer/file_system/file_system.dart'; |
| 15 import 'package:analyzer/instrumentation/instrumentation.dart'; | 15 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 16 import 'package:analyzer/plugin/options.dart'; | 16 import 'package:analyzer/plugin/options.dart'; |
| 17 import 'package:analyzer/source/analysis_options_provider.dart'; | 17 import 'package:analyzer/source/analysis_options_provider.dart'; |
| 18 import 'package:analyzer/source/package_map_provider.dart'; | 18 import 'package:analyzer/source/package_map_provider.dart'; |
| 19 import 'package:analyzer/source/package_map_resolver.dart'; | 19 import 'package:analyzer/source/package_map_resolver.dart'; |
| 20 import 'package:analyzer/source/path_filter.dart'; | 20 import 'package:analyzer/source/path_filter.dart'; |
| 21 import 'package:analyzer/source/pub_package_map_provider.dart'; | 21 import 'package:analyzer/source/pub_package_map_provider.dart'; |
| 22 import 'package:analyzer/source/sdk_ext.dart'; | 22 import 'package:analyzer/source/sdk_ext.dart'; |
| 23 import 'package:analyzer/src/context/context.dart' as context; | 23 import 'package:analyzer/src/context/context.dart' as context; |
| 24 import 'package:analyzer/src/generated/engine.dart'; | 24 import 'package:analyzer/src/generated/engine.dart'; |
| 25 import 'package:analyzer/src/generated/error.dart'; | 25 import 'package:analyzer/src/generated/error.dart'; |
| 26 import 'package:analyzer/src/generated/java_engine.dart'; | 26 import 'package:analyzer/src/generated/java_engine.dart'; |
| 27 import 'package:analyzer/src/generated/java_io.dart'; | 27 import 'package:analyzer/src/generated/java_io.dart'; |
| 28 import 'package:analyzer/src/generated/source.dart'; | 28 import 'package:analyzer/src/generated/source.dart'; |
| 29 import 'package:analyzer/src/generated/source_io.dart'; | 29 import 'package:analyzer/src/generated/source_io.dart'; |
| 30 import 'package:analyzer/src/task/options.dart'; |
| 30 import 'package:package_config/packages.dart'; | 31 import 'package:package_config/packages.dart'; |
| 31 import 'package:package_config/packages_file.dart' as pkgfile show parse; | 32 import 'package:package_config/packages_file.dart' as pkgfile show parse; |
| 32 import 'package:package_config/src/packages_impl.dart' show MapPackages; | 33 import 'package:package_config/src/packages_impl.dart' show MapPackages; |
| 33 import 'package:path/path.dart' as pathos; | 34 import 'package:path/path.dart' as pathos; |
| 34 import 'package:watcher/watcher.dart'; | 35 import 'package:watcher/watcher.dart'; |
| 35 import 'package:yaml/yaml.dart'; | 36 import 'package:yaml/yaml.dart'; |
| 36 | 37 |
| 37 /** | 38 /** |
| 38 * Information tracked by the [ContextManager] for each context. | 39 * Information tracked by the [ContextManager] for each context. |
| 39 */ | 40 */ |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 | 547 |
| 547 // Rebuild contexts based on the data last sent to setRoots(). | 548 // Rebuild contexts based on the data last sent to setRoots(). |
| 548 setRoots(includedPaths, excludedPaths, packageRoots); | 549 setRoots(includedPaths, excludedPaths, packageRoots); |
| 549 } | 550 } |
| 550 | 551 |
| 551 void setFiltersForContext(ContextInfo info, YamlNode codes) { | 552 void setFiltersForContext(ContextInfo info, YamlNode codes) { |
| 552 List<ErrorFilter> filters = <ErrorFilter>[]; | 553 List<ErrorFilter> filters = <ErrorFilter>[]; |
| 553 // If codes are enumerated, collect them as filters; else leave filters | 554 // If codes are enumerated, collect them as filters; else leave filters |
| 554 // empty to overwrite previous value. | 555 // empty to overwrite previous value. |
| 555 if (codes is YamlMap) { | 556 if (codes is YamlMap) { |
| 556 String code, value; | 557 String value; |
| 557 codes.nodes.forEach((k, v) { | 558 codes.nodes.forEach((k, v) { |
| 558 if (k is YamlScalar && v is YamlScalar) { | 559 if (k is YamlScalar && v is YamlScalar) { |
| 559 value = v.value?.toString()?.toLowerCase(); | 560 value = v.value?.toString()?.toLowerCase(); |
| 560 if (value == 'false' || value == 'ignore') { | 561 if (AnalyzerOptions.ignoreSynonyms.contains(value)) { |
| 561 // Case-insensitive. | 562 // Case-insensitive. |
| 562 code = k.value?.toString()?.toUpperCase(); | 563 String code = k.value?.toString()?.toUpperCase(); |
| 563 filters.add((AnalysisError error) => error.errorCode.name == code); | 564 filters.add((AnalysisError error) => error.errorCode.name == code); |
| 564 } | 565 } |
| 565 } | 566 } |
| 566 }); | 567 }); |
| 567 } | 568 } |
| 568 info.context.setConfigurationData(CONFIGURED_ERROR_FILTERS, filters); | 569 info.context.setConfigurationData(CONFIGURED_ERROR_FILTERS, filters); |
| 569 } | 570 } |
| 570 | 571 |
| 571 /** | 572 /** |
| 572 * Sets the [ignorePatterns] for the context having info [info]. | 573 * Sets the [ignorePatterns] for the context having info [info]. |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 var path = resourceProvider.pathContext.fromUri(uri); | 1471 var path = resourceProvider.pathContext.fromUri(uri); |
| 1471 packageMap[name] = <Folder>[resourceProvider.getFolder(path)]; | 1472 packageMap[name] = <Folder>[resourceProvider.getFolder(path)]; |
| 1472 } | 1473 } |
| 1473 }); | 1474 }); |
| 1474 return <UriResolver>[new SdkExtUriResolver(packageMap)]; | 1475 return <UriResolver>[new SdkExtUriResolver(packageMap)]; |
| 1475 } else { | 1476 } else { |
| 1476 return const <UriResolver>[]; | 1477 return const <UriResolver>[]; |
| 1477 } | 1478 } |
| 1478 } | 1479 } |
| 1479 } | 1480 } |
| OLD | NEW |