| 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 analysis.server; | 5 library analysis.server; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:core' hide Resource; | 9 import 'dart:core' hide Resource; |
| 10 import 'dart:math' show max; | 10 import 'dart:math' show max; |
| 11 | 11 |
| 12 import 'package:analysis_server/plugin/analyzed_files.dart'; | 12 import 'package:analysis_server/plugin/analyzed_files.dart'; |
| 13 import 'package:analysis_server/src/analysis_logger.dart'; | 13 import 'package:analysis_server/src/analysis_logger.dart'; |
| 14 import 'package:analysis_server/src/channel/channel.dart'; | 14 import 'package:analysis_server/src/channel/channel.dart'; |
| 15 import 'package:analysis_server/src/context_manager.dart'; | 15 import 'package:analysis_server/src/context_manager.dart'; |
| 16 import 'package:analysis_server/src/operation/operation.dart'; | 16 import 'package:analysis_server/src/operation/operation.dart'; |
| 17 import 'package:analysis_server/src/operation/operation_analysis.dart'; | 17 import 'package:analysis_server/src/operation/operation_analysis.dart'; |
| 18 import 'package:analysis_server/src/operation/operation_queue.dart'; | 18 import 'package:analysis_server/src/operation/operation_queue.dart'; |
| 19 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 19 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
| 20 import 'package:analysis_server/src/protocol.dart' hide Element; | 20 import 'package:analysis_server/src/protocol.dart' hide Element; |
| 21 import 'package:analysis_server/src/services/correction/namespace.dart'; | 21 import 'package:analysis_server/src/services/correction/namespace.dart'; |
| 22 import 'package:analysis_server/src/services/index/index.dart'; | 22 import 'package:analysis_server/src/services/index/index.dart'; |
| 23 import 'package:analysis_server/src/services/search/search_engine.dart'; | 23 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 24 import 'package:analysis_server/src/source/optimizing_pub_package_map_provider.d
art'; | 24 import 'package:analysis_server/src/source/optimizing_pub_package_map_provider.d
art'; |
| 25 import 'package:analysis_server/uri/resolver_provider.dart'; |
| 25 import 'package:analyzer/file_system/file_system.dart'; | 26 import 'package:analyzer/file_system/file_system.dart'; |
| 26 import 'package:analyzer/instrumentation/instrumentation.dart'; | 27 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 27 import 'package:analyzer/src/generated/ast.dart'; | 28 import 'package:analyzer/src/generated/ast.dart'; |
| 28 import 'package:analyzer/src/generated/element.dart'; | 29 import 'package:analyzer/src/generated/element.dart'; |
| 29 import 'package:analyzer/src/generated/engine.dart'; | 30 import 'package:analyzer/src/generated/engine.dart'; |
| 30 import 'package:analyzer/src/generated/java_engine.dart'; | 31 import 'package:analyzer/src/generated/java_engine.dart'; |
| 31 import 'package:analyzer/src/generated/sdk.dart'; | 32 import 'package:analyzer/src/generated/sdk.dart'; |
| 32 import 'package:analyzer/src/generated/source.dart'; | 33 import 'package:analyzer/src/generated/source.dart'; |
| 33 import 'package:analyzer/src/generated/source_io.dart'; | 34 import 'package:analyzer/src/generated/source_io.dart'; |
| 34 import 'package:analyzer/src/generated/utilities_general.dart'; | 35 import 'package:analyzer/src/generated/utilities_general.dart'; |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 * | 254 * |
| 254 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are | 255 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are |
| 255 * propagated up the call stack. The default is true to allow analysis | 256 * propagated up the call stack. The default is true to allow analysis |
| 256 * exceptions to show up in unit tests, but it should be set to false when | 257 * exceptions to show up in unit tests, but it should be set to false when |
| 257 * running a full analysis server. | 258 * running a full analysis server. |
| 258 */ | 259 */ |
| 259 AnalysisServer(this.channel, this.resourceProvider, | 260 AnalysisServer(this.channel, this.resourceProvider, |
| 260 OptimizingPubPackageMapProvider packageMapProvider, Index _index, | 261 OptimizingPubPackageMapProvider packageMapProvider, Index _index, |
| 261 this.serverPlugin, AnalysisServerOptions analysisServerOptions, | 262 this.serverPlugin, AnalysisServerOptions analysisServerOptions, |
| 262 this.defaultSdk, this.instrumentationService, | 263 this.defaultSdk, this.instrumentationService, |
| 263 {this.rethrowExceptions: true}) | 264 {ResolverProvider packageResolverProvider: null, |
| 265 this.rethrowExceptions: true}) |
| 264 : index = _index, | 266 : index = _index, |
| 265 searchEngine = _index != null ? createSearchEngine(_index) : null { | 267 searchEngine = _index != null ? createSearchEngine(_index) : null { |
| 266 _performance = performanceDuringStartup; | 268 _performance = performanceDuringStartup; |
| 267 operationQueue = new ServerOperationQueue(); | 269 operationQueue = new ServerOperationQueue(); |
| 268 contextDirectoryManager = new ServerContextManager( | 270 contextDirectoryManager = new ServerContextManager(this, resourceProvider, |
| 269 this, resourceProvider, packageMapProvider, instrumentationService); | 271 packageResolverProvider, packageMapProvider, instrumentationService); |
| 270 contextDirectoryManager.defaultOptions.incremental = true; | 272 contextDirectoryManager.defaultOptions.incremental = true; |
| 271 contextDirectoryManager.defaultOptions.incrementalApi = | 273 contextDirectoryManager.defaultOptions.incrementalApi = |
| 272 analysisServerOptions.enableIncrementalResolutionApi; | 274 analysisServerOptions.enableIncrementalResolutionApi; |
| 273 contextDirectoryManager.defaultOptions.incrementalValidation = | 275 contextDirectoryManager.defaultOptions.incrementalValidation = |
| 274 analysisServerOptions.enableIncrementalResolutionValidation; | 276 analysisServerOptions.enableIncrementalResolutionValidation; |
| 275 contextDirectoryManager.defaultOptions.generateImplicitErrors = false; | 277 contextDirectoryManager.defaultOptions.generateImplicitErrors = false; |
| 276 _noErrorNotification = analysisServerOptions.noErrorNotification; | 278 _noErrorNotification = analysisServerOptions.noErrorNotification; |
| 277 AnalysisEngine.instance.logger = new AnalysisLogger(); | 279 AnalysisEngine.instance.logger = new AnalysisLogger(); |
| 278 _onAnalysisStartedController = new StreamController.broadcast(); | 280 _onAnalysisStartedController = new StreamController.broadcast(); |
| 279 _onFileAnalyzedController = new StreamController.broadcast(); | 281 _onFileAnalyzedController = new StreamController.broadcast(); |
| (...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 * The default options used to create new analysis contexts. | 1305 * The default options used to create new analysis contexts. |
| 1304 */ | 1306 */ |
| 1305 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); | 1307 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); |
| 1306 | 1308 |
| 1307 /** | 1309 /** |
| 1308 * The controller for sending [ContextsChangedEvent]s. | 1310 * The controller for sending [ContextsChangedEvent]s. |
| 1309 */ | 1311 */ |
| 1310 StreamController<ContextsChangedEvent> _onContextsChangedController; | 1312 StreamController<ContextsChangedEvent> _onContextsChangedController; |
| 1311 | 1313 |
| 1312 ServerContextManager(this.analysisServer, ResourceProvider resourceProvider, | 1314 ServerContextManager(this.analysisServer, ResourceProvider resourceProvider, |
| 1315 ResolverProvider packageResolverProvider, |
| 1313 OptimizingPubPackageMapProvider packageMapProvider, | 1316 OptimizingPubPackageMapProvider packageMapProvider, |
| 1314 InstrumentationService service) | 1317 InstrumentationService service) |
| 1315 : super(resourceProvider, packageMapProvider, service) { | 1318 : super(resourceProvider, packageResolverProvider, packageMapProvider, |
| 1319 service) { |
| 1316 _onContextsChangedController = | 1320 _onContextsChangedController = |
| 1317 new StreamController<ContextsChangedEvent>.broadcast(); | 1321 new StreamController<ContextsChangedEvent>.broadcast(); |
| 1318 } | 1322 } |
| 1319 | 1323 |
| 1320 /** | 1324 /** |
| 1321 * The stream that is notified when contexts are added or removed. | 1325 * The stream that is notified when contexts are added or removed. |
| 1322 */ | 1326 */ |
| 1323 Stream<ContextsChangedEvent> get onContextsChanged => | 1327 Stream<ContextsChangedEvent> get onContextsChanged => |
| 1324 _onContextsChangedController.stream; | 1328 _onContextsChangedController.stream; |
| 1325 | 1329 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 /** | 1531 /** |
| 1528 * The [PerformanceTag] for time spent in server request handlers. | 1532 * The [PerformanceTag] for time spent in server request handlers. |
| 1529 */ | 1533 */ |
| 1530 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1534 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 1531 | 1535 |
| 1532 /** | 1536 /** |
| 1533 * The [PerformanceTag] for time spent in split store microtasks. | 1537 * The [PerformanceTag] for time spent in split store microtasks. |
| 1534 */ | 1538 */ |
| 1535 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1539 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 1536 } | 1540 } |
| OLD | NEW |