| 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 socket.server; | 5 library socket.server; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
| 8 import 'package:analysis_server/src/channel/channel.dart'; | 8 import 'package:analysis_server/src/channel/channel.dart'; |
| 9 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 9 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
| 10 import 'package:analysis_server/src/protocol.dart'; | 10 import 'package:analysis_server/src/protocol.dart'; |
| 11 import 'package:analysis_server/src/services/index/index.dart'; | 11 import 'package:analysis_server/src/services/index/index.dart'; |
| 12 import 'package:analysis_server/src/services/index/local_file_index.dart'; | 12 import 'package:analysis_server/src/services/index/local_file_index.dart'; |
| 13 import 'package:analysis_server/src/source/caching_pub_package_map_provider.dart
'; | |
| 14 import 'package:analyzer/file_system/physical_file_system.dart'; | 13 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 15 import 'package:analyzer/instrumentation/instrumentation.dart'; | 14 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 15 import 'package:analyzer/source/pub_package_map_provider.dart'; |
| 16 import 'package:analyzer/src/generated/sdk_io.dart'; | 16 import 'package:analyzer/src/generated/sdk_io.dart'; |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * Instances of the class [SocketServer] implement the common parts of | 19 * Instances of the class [SocketServer] implement the common parts of |
| 20 * http-based and stdio-based analysis servers. The primary responsibility of | 20 * http-based and stdio-based analysis servers. The primary responsibility of |
| 21 * the SocketServer is to manage the lifetime of the AnalysisServer and to | 21 * the SocketServer is to manage the lifetime of the AnalysisServer and to |
| 22 * encode and decode the JSON messages exchanged with the client. | 22 * encode and decode the JSON messages exchanged with the client. |
| 23 */ | 23 */ |
| 24 class SocketServer { | 24 class SocketServer { |
| 25 final AnalysisServerOptions analysisServerOptions; | 25 final AnalysisServerOptions analysisServerOptions; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 'File read mode was set to the unknown mode: $analysisServerOptions.fi
leReadMode'); | 62 'File read mode was set to the unknown mode: $analysisServerOptions.fi
leReadMode'); |
| 63 } | 63 } |
| 64 | 64 |
| 65 Index index = null; | 65 Index index = null; |
| 66 if (!analysisServerOptions.noIndex) { | 66 if (!analysisServerOptions.noIndex) { |
| 67 index = createLocalFileIndex(); | 67 index = createLocalFileIndex(); |
| 68 index.run(); | 68 index.run(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 analysisServer = new AnalysisServer(serverChannel, resourceProvider, | 71 analysisServer = new AnalysisServer(serverChannel, resourceProvider, |
| 72 new CachingPubPackageMapProvider(resourceProvider, defaultSdk), index, | 72 new PubPackageMapProvider(resourceProvider, defaultSdk), index, |
| 73 analysisServerOptions, defaultSdk, instrumentationService, | 73 analysisServerOptions, defaultSdk, instrumentationService, |
| 74 rethrowExceptions: false); | 74 rethrowExceptions: false); |
| 75 _initializeHandlers(analysisServer); | 75 _initializeHandlers(analysisServer); |
| 76 } | 76 } |
| 77 | 77 |
| 78 /** | 78 /** |
| 79 * Initialize the handlers to be used by the given [server]. | 79 * Initialize the handlers to be used by the given [server]. |
| 80 */ | 80 */ |
| 81 void _initializeHandlers(AnalysisServer server) { | 81 void _initializeHandlers(AnalysisServer server) { |
| 82 server.handlers = serverPlugin.createDomains(server); | 82 server.handlers = serverPlugin.createDomains(server); |
| 83 } | 83 } |
| 84 } | 84 } |
| OLD | NEW |