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'; | 9 import 'dart:core'; |
10 import 'dart:io' as io; | 10 import 'dart:io' as io; |
11 import 'dart:math' show max; | 11 import 'dart:math' show max; |
12 | 12 |
13 import 'package:analysis_server/plugin/protocol/protocol.dart' | 13 import 'package:analysis_server/plugin/protocol/protocol.dart' |
14 hide AnalysisOptions, Element; | 14 hide AnalysisOptions, Element; |
15 import 'package:analysis_server/src/analysis_logger.dart'; | 15 import 'package:analysis_server/src/analysis_logger.dart'; |
16 import 'package:analysis_server/src/channel/channel.dart'; | 16 import 'package:analysis_server/src/channel/channel.dart'; |
17 import 'package:analysis_server/src/computer/new_notifications.dart'; | 17 import 'package:analysis_server/src/computer/new_notifications.dart'; |
18 import 'package:analysis_server/src/context_manager.dart'; | 18 import 'package:analysis_server/src/context_manager.dart'; |
19 import 'package:analysis_server/src/operation/operation.dart'; | 19 import 'package:analysis_server/src/operation/operation.dart'; |
20 import 'package:analysis_server/src/operation/operation_analysis.dart'; | 20 import 'package:analysis_server/src/operation/operation_analysis.dart'; |
21 import 'package:analysis_server/src/operation/operation_queue.dart'; | 21 import 'package:analysis_server/src/operation/operation_queue.dart'; |
22 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 22 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
| 23 import 'package:analysis_server/src/server/diagnostic_server.dart'; |
23 import 'package:analysis_server/src/services/correction/namespace.dart'; | 24 import 'package:analysis_server/src/services/correction/namespace.dart'; |
24 import 'package:analysis_server/src/services/index/index.dart'; | 25 import 'package:analysis_server/src/services/index/index.dart'; |
25 import 'package:analysis_server/src/services/search/search_engine.dart'; | 26 import 'package:analysis_server/src/services/search/search_engine.dart'; |
26 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; | 27 import 'package:analysis_server/src/services/search/search_engine_internal.dart'
; |
27 import 'package:analysis_server/src/services/search/search_engine_internal2.dart
'; | 28 import 'package:analysis_server/src/services/search/search_engine_internal2.dart
'; |
28 import 'package:analysis_server/src/single_context_manager.dart'; | 29 import 'package:analysis_server/src/single_context_manager.dart'; |
29 import 'package:analysis_server/src/utilities/null_string_sink.dart'; | 30 import 'package:analysis_server/src/utilities/null_string_sink.dart'; |
30 import 'package:analyzer/dart/ast/ast.dart'; | 31 import 'package:analyzer/dart/ast/ast.dart'; |
31 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 32 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
32 import 'package:analyzer/dart/element/element.dart'; | 33 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 85 |
85 /** | 86 /** |
86 * Instances of the class [AnalysisServer] implement a server that listens on a | 87 * Instances of the class [AnalysisServer] implement a server that listens on a |
87 * [CommunicationChannel] for analysis requests and process them. | 88 * [CommunicationChannel] for analysis requests and process them. |
88 */ | 89 */ |
89 class AnalysisServer { | 90 class AnalysisServer { |
90 /** | 91 /** |
91 * The version of the analysis server. The value should be replaced | 92 * The version of the analysis server. The value should be replaced |
92 * automatically during the build. | 93 * automatically during the build. |
93 */ | 94 */ |
94 static final String VERSION = '1.17.0'; | 95 static final String VERSION = '1.18.0'; |
95 | 96 |
96 /** | 97 /** |
97 * The number of milliseconds to perform operations before inserting | 98 * The number of milliseconds to perform operations before inserting |
98 * a 1 millisecond delay so that the VM and dart:io can deliver content | 99 * a 1 millisecond delay so that the VM and dart:io can deliver content |
99 * to stdin. This should be removed once the underlying problem is fixed. | 100 * to stdin. This should be removed once the underlying problem is fixed. |
100 */ | 101 */ |
101 static int performOperationDelayFrequency = 25; | 102 static int performOperationDelayFrequency = 25; |
102 | 103 |
103 /** | 104 /** |
104 * The options of this server instance. | 105 * The options of this server instance. |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 nd.PerformanceLog _analysisPerformanceLogger; | 323 nd.PerformanceLog _analysisPerformanceLogger; |
323 ByteStore byteStore; | 324 ByteStore byteStore; |
324 nd.AnalysisDriverScheduler analysisDriverScheduler; | 325 nd.AnalysisDriverScheduler analysisDriverScheduler; |
325 | 326 |
326 /** | 327 /** |
327 * The set of the files that are currently priority. | 328 * The set of the files that are currently priority. |
328 */ | 329 */ |
329 final Set<String> priorityFiles = new Set<String>(); | 330 final Set<String> priorityFiles = new Set<String>(); |
330 | 331 |
331 /** | 332 /** |
| 333 * The DiagnosticServer for this AnalysisServer. If available, it can be used |
| 334 * to start an http diagnostics server or return the port for an existing |
| 335 * server. |
| 336 */ |
| 337 DiagnosticServer diagnosticServer; |
| 338 |
| 339 /** |
332 * Initialize a newly created server to receive requests from and send | 340 * Initialize a newly created server to receive requests from and send |
333 * responses to the given [channel]. | 341 * responses to the given [channel]. |
334 * | 342 * |
335 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are | 343 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are |
336 * propagated up the call stack. The default is true to allow analysis | 344 * propagated up the call stack. The default is true to allow analysis |
337 * exceptions to show up in unit tests, but it should be set to false when | 345 * exceptions to show up in unit tests, but it should be set to false when |
338 * running a full analysis server. | 346 * running a full analysis server. |
339 */ | 347 */ |
340 AnalysisServer( | 348 AnalysisServer( |
341 this.channel, | 349 this.channel, |
342 this.resourceProvider, | 350 this.resourceProvider, |
343 PubPackageMapProvider packageMapProvider, | 351 PubPackageMapProvider packageMapProvider, |
344 this.index, | 352 this.index, |
345 this.serverPlugin, | 353 this.serverPlugin, |
346 this.options, | 354 this.options, |
347 this.sdkManager, | 355 this.sdkManager, |
348 this.instrumentationService, | 356 this.instrumentationService, |
349 {ResolverProvider fileResolverProvider: null, | 357 {this.diagnosticServer, |
| 358 ResolverProvider fileResolverProvider: null, |
350 ResolverProvider packageResolverProvider: null, | 359 ResolverProvider packageResolverProvider: null, |
351 bool useSingleContextManager: false, | 360 bool useSingleContextManager: false, |
352 this.rethrowExceptions: true}) { | 361 this.rethrowExceptions: true}) { |
353 _performance = performanceDuringStartup; | 362 _performance = performanceDuringStartup; |
354 defaultContextOptions.incremental = true; | 363 defaultContextOptions.incremental = true; |
355 defaultContextOptions.incrementalApi = | 364 defaultContextOptions.incrementalApi = |
356 options.enableIncrementalResolutionApi; | 365 options.enableIncrementalResolutionApi; |
357 defaultContextOptions.incrementalValidation = | 366 defaultContextOptions.incrementalValidation = |
358 options.enableIncrementalResolutionValidation; | 367 options.enableIncrementalResolutionValidation; |
359 defaultContextOptions.finerGrainedInvalidation = | 368 defaultContextOptions.finerGrainedInvalidation = |
(...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2125 /** | 2134 /** |
2126 * The [PerformanceTag] for time spent in server request handlers. | 2135 * The [PerformanceTag] for time spent in server request handlers. |
2127 */ | 2136 */ |
2128 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 2137 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
2129 | 2138 |
2130 /** | 2139 /** |
2131 * The [PerformanceTag] for time spent in split store microtasks. | 2140 * The [PerformanceTag] for time spent in split store microtasks. |
2132 */ | 2141 */ |
2133 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 2142 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
2134 } | 2143 } |
OLD | NEW |