Chromium Code Reviews| 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 domain.analysis; | 5 library domain.analysis; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
| 10 import 'package:analysis_server/src/computer/computer_hover.dart'; | 10 import 'package:analysis_server/src/computer/computer_hover.dart'; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 Response response = new Response(request.id); | 40 Response response = new Response(request.id); |
| 41 AnalysisErrorInfo errorInfo = server.getErrors(file); | 41 AnalysisErrorInfo errorInfo = server.getErrors(file); |
| 42 if (errorInfo == null) { | 42 if (errorInfo == null) { |
| 43 response.setResult(ERRORS, []); | 43 response.setResult(ERRORS, []); |
| 44 } else { | 44 } else { |
| 45 response.setResult(ERRORS, errorInfo.errors.map((AnalysisError error) { | 45 response.setResult(ERRORS, errorInfo.errors.map((AnalysisError error) { |
| 46 return errorToJson(errorInfo.lineInfo, error); | 46 return errorToJson(errorInfo.lineInfo, error); |
| 47 }).toList()); | 47 }).toList()); |
| 48 } | 48 } |
| 49 server.sendResponse(response); | 49 server.sendResponse(response); |
| 50 }); | 50 }).catchError((message) { |
| 51 Response response = new Response.getErrorsError(request, message); | |
| 52 response.setResult(ERRORS, []); | |
|
Paul Berry
2014/07/23 15:06:51
In this case wouldn't it be more appropriate for t
scheglov
2014/07/24 16:54:04
The "errors" field in response is not optional.
| |
| 53 server.sendResponse(response); | |
| 54 }, test: (e) => e is String); | |
|
Paul Berry
2014/07/23 15:06:51
This means that in the unlikely event that e is no
scheglov
2014/07/24 16:54:04
Done.
| |
| 51 // delay response | 55 // delay response |
| 52 return Response.DELAYED_RESPONSE; | 56 return Response.DELAYED_RESPONSE; |
| 53 } | 57 } |
| 54 | 58 |
| 55 /** | 59 /** |
| 56 * Implement the `analysis.getHover` request. | 60 * Implement the `analysis.getHover` request. |
| 57 */ | 61 */ |
| 58 Response getHover(Request request) { | 62 Response getHover(Request request) { |
| 59 // prepare parameters | 63 // prepare parameters |
| 60 String file = request.getRequiredParameter(FILE).asString(); | 64 String file = request.getRequiredParameter(FILE).asString(); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 | 253 |
| 250 /** | 254 /** |
| 251 * A description of the change to the content of a file. | 255 * A description of the change to the content of a file. |
| 252 */ | 256 */ |
| 253 class ContentChange { | 257 class ContentChange { |
| 254 String content; | 258 String content; |
| 255 int offset; | 259 int offset; |
| 256 int oldLength; | 260 int oldLength; |
| 257 int newLength; | 261 int newLength; |
| 258 } | 262 } |
| OLD | NEW |