| 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 search.domain; | 5 library search.domain; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 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/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
| 11 import 'package:analysis_server/src/protocol.dart'; | 11 import 'package:analysis_server/src/protocol.dart'; |
| 12 import 'package:analysis_server/src/protocol2.dart' as protocol; | 12 import 'package:analysis_server/src/protocol2.dart' as protocol; |
| 13 import 'package:analysis_server/src/search/element_references.dart'; | 13 import 'package:analysis_server/src/search/element_references.dart'; |
| 14 import 'package:analysis_server/src/search/type_hierarchy.dart'; | 14 import 'package:analysis_server/src/search/type_hierarchy.dart'; |
| 15 import 'package:analysis_server/src/services/json.dart'; | |
| 16 import 'package:analysis_server/src/services/search/search_engine.dart'; | 15 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 17 import 'package:analyzer/src/generated/element.dart'; | 16 import 'package:analyzer/src/generated/element.dart'; |
| 18 | 17 |
| 19 /** | 18 /** |
| 20 * Instances of the class [SearchDomainHandler] implement a [RequestHandler] | 19 * Instances of the class [SearchDomainHandler] implement a [RequestHandler] |
| 21 * that handles requests in the search domain. | 20 * that handles requests in the search domain. |
| 22 */ | 21 */ |
| 23 class SearchDomainHandler implements RequestHandler { | 22 class SearchDomainHandler implements RequestHandler { |
| 24 /** | 23 /** |
| 25 * The analysis server that is using this handler to process requests. | 24 * The analysis server that is using this handler to process requests. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 return getTypeHierarchy(request); | 166 return getTypeHierarchy(request); |
| 168 } | 167 } |
| 169 } on RequestFailure catch (exception) { | 168 } on RequestFailure catch (exception) { |
| 170 return exception.response; | 169 return exception.response; |
| 171 } | 170 } |
| 172 return null; | 171 return null; |
| 173 } | 172 } |
| 174 | 173 |
| 175 void _sendSearchNotification(String searchId, bool isLast, | 174 void _sendSearchNotification(String searchId, bool isLast, |
| 176 Iterable<protocol.SearchResult> results) { | 175 Iterable<protocol.SearchResult> results) { |
| 177 Notification notification = new Notification(SEARCH_RESULTS); | 176 server.sendNotification(new protocol.SearchResultsParams(searchId, |
| 178 notification.setParameter(ID, searchId); | 177 results.toList(), isLast).toNotification()); |
| 179 notification.setParameter(LAST, isLast); | |
| 180 notification.setParameter(RESULTS, objectToJson(results)); | |
| 181 server.sendNotification(notification); | |
| 182 } | 178 } |
| 183 | 179 |
| 184 static protocol.SearchResult toResult(SearchMatch match) { | 180 static protocol.SearchResult toResult(SearchMatch match) { |
| 185 return new protocol.SearchResult.fromMatch(match); | 181 return new protocol.SearchResult.fromMatch(match); |
| 186 } | 182 } |
| 187 } | 183 } |
| OLD | NEW |