| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:convert'; | 6 import 'dart:convert'; |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:analysis_server/src/channel/channel.dart'; | 10 import 'package:analysis_server/src/channel/channel.dart'; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 110 } |
| 111 throw 'Failed to connect to analysis server at $serverUrl\n $error'; | 111 throw 'Failed to connect to analysis server at $serverUrl\n $error'; |
| 112 }; | 112 }; |
| 113 try { | 113 try { |
| 114 WebSocket socket = await WebSocket.connect(serverUrl).catchError(onError); | 114 WebSocket socket = await WebSocket.connect(serverUrl).catchError(onError); |
| 115 this.channel = new WebSocketClientChannel(socket); | 115 this.channel = new WebSocketClientChannel(socket); |
| 116 return this; | 116 return this; |
| 117 } catch (error) { | 117 } catch (error) { |
| 118 onError(error); | 118 onError(error); |
| 119 } | 119 } |
| 120 return null; |
| 120 } | 121 } |
| 121 | 122 |
| 122 /** | 123 /** |
| 123 * Open a connection to a running analysis server | 124 * Open a connection to a running analysis server |
| 124 * and return a future with a manager for that analysis server. | 125 * and return a future with a manager for that analysis server. |
| 125 */ | 126 */ |
| 126 static Future<AnalysisManager> connect(String serverUrl) { | 127 static Future<AnalysisManager> connect(String serverUrl) { |
| 127 return new AnalysisManager()._openConnection(serverUrl); | 128 return new AnalysisManager()._openConnection(serverUrl); |
| 128 } | 129 } |
| 129 | 130 |
| 130 /** | 131 /** |
| 131 * Launch analysis server in a separate process | 132 * Launch analysis server in a separate process |
| 132 * and return a future with a manager for that analysis server. | 133 * and return a future with a manager for that analysis server. |
| 133 */ | 134 */ |
| 134 static Future<AnalysisManager> start(String serverPath) { | 135 static Future<AnalysisManager> start(String serverPath) { |
| 135 return new AnalysisManager()._launchServer(serverPath); | 136 return new AnalysisManager()._launchServer(serverPath); |
| 136 } | 137 } |
| 137 } | 138 } |
| OLD | NEW |