| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 List<SearchMatch> matches = | 134 List<SearchMatch> matches = |
| 135 await searchEngine.searchTopLevelDeclarations(params.pattern); | 135 await searchEngine.searchTopLevelDeclarations(params.pattern); |
| 136 matches = SearchMatch.withNotNullElement(matches); | 136 matches = SearchMatch.withNotNullElement(matches); |
| 137 _sendSearchNotification(searchId, true, matches.map(toResult)); | 137 _sendSearchNotification(searchId, true, matches.map(toResult)); |
| 138 } | 138 } |
| 139 | 139 |
| 140 /** | 140 /** |
| 141 * Implement the `search.getTypeHierarchy` request. | 141 * Implement the `search.getTypeHierarchy` request. |
| 142 */ | 142 */ |
| 143 Future getTypeHierarchy(protocol.Request request) async { | 143 Future getTypeHierarchy(protocol.Request request) async { |
| 144 if (server.options.enableNewAnalysisDriver) { | |
| 145 // TODO(scheglov) implement for the new analysis driver | |
| 146 protocol.Response response = | |
| 147 new protocol.SearchGetTypeHierarchyResult(hierarchyItems: []) | |
| 148 .toResponse(request.id); | |
| 149 server.sendResponse(response); | |
| 150 return; | |
| 151 } | |
| 152 var params = new protocol.SearchGetTypeHierarchyParams.fromRequest(request); | 144 var params = new protocol.SearchGetTypeHierarchyParams.fromRequest(request); |
| 153 String file = params.file; | 145 String file = params.file; |
| 154 // wait for analysis | 146 // wait for analysis |
| 155 if (params.superOnly == true) { | 147 if (!server.options.enableNewAnalysisDriver) { |
| 156 await server.onFileAnalysisComplete(file); | 148 if (params.superOnly == true) { |
| 157 } else { | 149 await server.onFileAnalysisComplete(file); |
| 158 await server.onAnalysisComplete; | 150 } else { |
| 151 await server.onAnalysisComplete; |
| 152 } |
| 159 } | 153 } |
| 160 // prepare element | 154 // prepare element |
| 161 Element element = await server.getElementAtOffset(file, params.offset); | 155 Element element = await server.getElementAtOffset(file, params.offset); |
| 162 if (element == null) { | 156 if (element == null) { |
| 163 _sendTypeHierarchyNull(request); | 157 _sendTypeHierarchyNull(request); |
| 164 return; | 158 return; |
| 165 } | 159 } |
| 166 // maybe supertype hierarchy only | 160 // maybe supertype hierarchy only |
| 167 if (params.superOnly == true) { | 161 if (params.superOnly == true) { |
| 168 TypeHierarchyComputer computer = | 162 TypeHierarchyComputer computer = |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 void _sendTypeHierarchyNull(protocol.Request request) { | 225 void _sendTypeHierarchyNull(protocol.Request request) { |
| 232 protocol.Response response = | 226 protocol.Response response = |
| 233 new protocol.SearchGetTypeHierarchyResult().toResponse(request.id); | 227 new protocol.SearchGetTypeHierarchyResult().toResponse(request.id); |
| 234 server.sendResponse(response); | 228 server.sendResponse(response); |
| 235 } | 229 } |
| 236 | 230 |
| 237 static protocol.SearchResult toResult(SearchMatch match) { | 231 static protocol.SearchResult toResult(SearchMatch match) { |
| 238 return protocol.newSearchResult_fromMatch(match); | 232 return protocol.newSearchResult_fromMatch(match); |
| 239 } | 233 } |
| 240 } | 234 } |
| OLD | NEW |