| 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 | 8 |
| 9 import 'package:analysis_server/src/analysis_logger.dart'; | 9 import 'package:analysis_server/src/analysis_logger.dart'; |
| 10 import 'package:analysis_server/src/channel.dart'; | 10 import 'package:analysis_server/src/channel.dart'; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * The name of the parameter whose value is a list of errors. | 25 * The name of the parameter whose value is a list of errors. |
| 26 */ | 26 */ |
| 27 static const String ERRORS_PARAM = 'errors'; | 27 static const String ERRORS_PARAM = 'errors'; |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * The name of the parameter whose value is a source. | 30 * The name of the parameter whose value is a source. |
| 31 */ | 31 */ |
| 32 static const String SOURCE_PARAM = 'source'; | 32 static const String SOURCE_PARAM = 'source'; |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * The name of the connected result value. |
| 36 */ |
| 37 static const String CONNECTED_RESULT = 'connected'; |
| 38 |
| 39 /** |
| 35 * The channel from which requests are received and to which responses should | 40 * The channel from which requests are received and to which responses should |
| 36 * be sent. | 41 * be sent. |
| 37 */ | 42 */ |
| 38 final ServerCommunicationChannel channel; | 43 final ServerCommunicationChannel channel; |
| 39 | 44 |
| 40 /** | 45 /** |
| 41 * A flag indicating whether the server is running. | 46 * A flag indicating whether the server is running. |
| 42 */ | 47 */ |
| 43 bool running; | 48 bool running; |
| 44 | 49 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 59 */ | 64 */ |
| 60 final List<AnalysisContext> contextWorkQueue = new List<AnalysisContext>(); | 65 final List<AnalysisContext> contextWorkQueue = new List<AnalysisContext>(); |
| 61 | 66 |
| 62 /** | 67 /** |
| 63 * Initialize a newly created server to receive requests from and send | 68 * Initialize a newly created server to receive requests from and send |
| 64 * responses to the given [channel]. | 69 * responses to the given [channel]. |
| 65 */ | 70 */ |
| 66 AnalysisServer(this.channel) { | 71 AnalysisServer(this.channel) { |
| 67 AnalysisEngine.instance.logger = new AnalysisLogger(); | 72 AnalysisEngine.instance.logger = new AnalysisLogger(); |
| 68 running = true; | 73 running = true; |
| 74 Response response = new Response(''); |
| 75 response.setResult(CONNECTED_RESULT, true); |
| 76 channel.sendResponse(response); |
| 69 channel.listen(handleRequest, onDone: done, onError: error); | 77 channel.listen(handleRequest, onDone: done, onError: error); |
| 70 } | 78 } |
| 71 | 79 |
| 72 /** | 80 /** |
| 73 * Add the given [context] to the list of analysis contexts for which analysis | 81 * Add the given [context] to the list of analysis contexts for which analysis |
| 74 * work needs to be performed. Ensure that the work will be performed. | 82 * work needs to be performed. Ensure that the work will be performed. |
| 75 */ | 83 */ |
| 76 void addContextToWorkQueue(AnalysisContext context) { | 84 void addContextToWorkQueue(AnalysisContext context) { |
| 77 if (!contextWorkQueue.contains(context)) { | 85 if (!contextWorkQueue.contains(context)) { |
| 78 contextWorkQueue.add(context); | 86 contextWorkQueue.add(context); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 } | 180 } |
| 173 } | 181 } |
| 174 | 182 |
| 175 /** | 183 /** |
| 176 * Send the given [notification] to the client. | 184 * Send the given [notification] to the client. |
| 177 */ | 185 */ |
| 178 void sendNotification(Notification notification) { | 186 void sendNotification(Notification notification) { |
| 179 channel.sendNotification(notification); | 187 channel.sendNotification(notification); |
| 180 } | 188 } |
| 181 } | 189 } |
| OLD | NEW |