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'; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 new TypeHierarchyComputer(searchEngine, element); | 173 new TypeHierarchyComputer(searchEngine, element); |
174 List<protocol.TypeHierarchyItem> items = await computer.compute(); | 174 List<protocol.TypeHierarchyItem> items = await computer.compute(); |
175 protocol.Response response = | 175 protocol.Response response = |
176 new protocol.SearchGetTypeHierarchyResult(hierarchyItems: items) | 176 new protocol.SearchGetTypeHierarchyResult(hierarchyItems: items) |
177 .toResponse(request.id); | 177 .toResponse(request.id); |
178 server.sendResponse(response); | 178 server.sendResponse(response); |
179 } | 179 } |
180 | 180 |
181 @override | 181 @override |
182 protocol.Response handleRequest(protocol.Request request) { | 182 protocol.Response handleRequest(protocol.Request request) { |
183 if (searchEngine == null) { | |
184 return new protocol.Response.noIndexGenerated(request); | |
185 } | |
186 try { | 183 try { |
187 String requestName = request.method; | 184 String requestName = request.method; |
188 if (requestName == SEARCH_FIND_ELEMENT_REFERENCES) { | 185 if (requestName == SEARCH_FIND_ELEMENT_REFERENCES) { |
189 findElementReferences(request); | 186 findElementReferences(request); |
190 return protocol.Response.DELAYED_RESPONSE; | 187 return protocol.Response.DELAYED_RESPONSE; |
191 } else if (requestName == SEARCH_FIND_MEMBER_DECLARATIONS) { | 188 } else if (requestName == SEARCH_FIND_MEMBER_DECLARATIONS) { |
192 findMemberDeclarations(request); | 189 findMemberDeclarations(request); |
193 return protocol.Response.DELAYED_RESPONSE; | 190 return protocol.Response.DELAYED_RESPONSE; |
194 } else if (requestName == SEARCH_FIND_MEMBER_REFERENCES) { | 191 } else if (requestName == SEARCH_FIND_MEMBER_REFERENCES) { |
195 findMemberReferences(request); | 192 findMemberReferences(request); |
(...skipping 29 matching lines...) Expand all Loading... |
225 void _sendTypeHierarchyNull(protocol.Request request) { | 222 void _sendTypeHierarchyNull(protocol.Request request) { |
226 protocol.Response response = | 223 protocol.Response response = |
227 new protocol.SearchGetTypeHierarchyResult().toResponse(request.id); | 224 new protocol.SearchGetTypeHierarchyResult().toResponse(request.id); |
228 server.sendResponse(response); | 225 server.sendResponse(response); |
229 } | 226 } |
230 | 227 |
231 static protocol.SearchResult toResult(SearchMatch match) { | 228 static protocol.SearchResult toResult(SearchMatch match) { |
232 return protocol.newSearchResult_fromMatch(match); | 229 return protocol.newSearchResult_fromMatch(match); |
233 } | 230 } |
234 } | 231 } |
OLD | NEW |