Chromium Code Reviews| Index: pkg/analysis_server/lib/src/analysis_server.dart |
| diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart |
| index cb6406e5d3765bf603163913f078ffcdb0de648a..f1c1d3f22b5c188cbfa97dfdfa6de23cc0496565 100644 |
| --- a/pkg/analysis_server/lib/src/analysis_server.dart |
| +++ b/pkg/analysis_server/lib/src/analysis_server.dart |
| @@ -10,6 +10,7 @@ import 'package:analysis_server/src/analysis_logger.dart'; |
| import 'package:analysis_server/src/channel.dart'; |
| import 'package:analysis_server/src/protocol.dart'; |
| import 'package:analyzer/src/generated/engine.dart'; |
| +import 'package:analyzer/src/generated/error.dart'; |
| /** |
| * Instances of the class [AnalysisServer] implement a server that listens on a |
| @@ -188,11 +189,31 @@ class AnalysisServer { |
| ChangeNotice notice = notices[i]; |
| Notification notification = new Notification(ERROR_NOTIFICATION_NAME); |
| notification.setParameter(SOURCE_PARAM, notice.source.encoding); |
| - notification.setParameter(ERRORS_PARAM, notice.errors); |
| + notification.setParameter(ERRORS_PARAM, new List.from(notice.errors.map( |
|
scheglov
2014/04/23 19:20:56
You could use .map(f).toList().
Paul Berry
2014/04/23 20:36:26
Done.
|
| + errorToJson))); |
| sendNotification(notification); |
| } |
| } |
| + static Map<String, Object> errorToJson(AnalysisError analysisError) { |
| + // TODO(paulberry): move this function into the AnalysisError class. |
| + |
| + // TODO(paulberry): add "ordinal" to errorCode interface so that this trick |
| + // with dynamic is unnecessary. |
|
scheglov
2014/04/23 19:20:56
You could probably cast it to Enum.
(errorCode as
Paul Berry
2014/04/23 20:36:26
Done.
|
| + dynamic errorCode = analysisError.errorCode; |
| + Map<String, Object> result = { |
| + 'source': analysisError.source.encoding, |
| + 'errorCode': errorCode.ordinal, |
|
scheglov
2014/04/23 19:20:56
I don't think that using "ordinal" is valid at all
Paul Berry
2014/04/23 20:36:26
Good point. I've updated the TODO comment accordi
Brian Wilkerson
2014/04/24 15:44:05
There has been some discussion in the past about c
|
| + 'offset': analysisError.offset, |
| + 'length': analysisError.length, |
| + 'message': analysisError.message |
| + }; |
| + if (analysisError.correction != null) { |
| + result['correction'] = analysisError.correction; |
| + } |
| + return result; |
| + } |
| + |
| /** |
| * Send the given [notification] to the client. |
| */ |