Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: pkg/analysis_server/lib/src/search/search_domain.dart

Issue 2512633002: Add stubs for requests that currently crash Analysis Server with the new analysis driver. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/domain_analysis.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 /** 43 /**
44 * Initialize a newly created handler to handle requests for the given [server ]. 44 * Initialize a newly created handler to handle requests for the given [server ].
45 */ 45 */
46 SearchDomainHandler(AnalysisServer server) 46 SearchDomainHandler(AnalysisServer server)
47 : server = server, 47 : server = server,
48 index = server.index, 48 index = server.index,
49 searchEngine = server.searchEngine; 49 searchEngine = server.searchEngine;
50 50
51 Future findElementReferences(protocol.Request request) async { 51 Future findElementReferences(protocol.Request request) async {
52 if (server.options.enableNewAnalysisDriver) {
53 // TODO(scheglov) implement for the new analysis driver
54 String searchId = (_nextSearchId++).toString();
55 var result = new protocol.SearchFindElementReferencesResult();
56 result.id = searchId;
57 _sendSearchResult(request, result);
58 _sendSearchNotification(searchId, true, <protocol.SearchResult>[]);
59 return;
60 }
52 var params = 61 var params =
53 new protocol.SearchFindElementReferencesParams.fromRequest(request); 62 new protocol.SearchFindElementReferencesParams.fromRequest(request);
54 await server.onAnalysisComplete; 63 await server.onAnalysisComplete;
55 // prepare elements 64 // prepare elements
56 List<Element> elements = 65 List<Element> elements =
57 server.getElementsAtOffset(params.file, params.offset); 66 server.getElementsAtOffset(params.file, params.offset);
58 elements = elements.map((Element element) { 67 elements = elements.map((Element element) {
59 if (element is ImportElement) { 68 if (element is ImportElement) {
60 return element.prefix; 69 return element.prefix;
61 } 70 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 List<SearchMatch> matches = 147 List<SearchMatch> matches =
139 await searchEngine.searchTopLevelDeclarations(params.pattern); 148 await searchEngine.searchTopLevelDeclarations(params.pattern);
140 matches = SearchMatch.withNotNullElement(matches); 149 matches = SearchMatch.withNotNullElement(matches);
141 _sendSearchNotification(searchId, true, matches.map(toResult)); 150 _sendSearchNotification(searchId, true, matches.map(toResult));
142 } 151 }
143 152
144 /** 153 /**
145 * Implement the `search.getTypeHierarchy` request. 154 * Implement the `search.getTypeHierarchy` request.
146 */ 155 */
147 Future getTypeHierarchy(protocol.Request request) async { 156 Future getTypeHierarchy(protocol.Request request) async {
157 if (server.options.enableNewAnalysisDriver) {
158 // TODO(scheglov) implement for the new analysis driver
159 protocol.Response response =
160 new protocol.SearchGetTypeHierarchyResult(hierarchyItems: [])
161 .toResponse(request.id);
162 server.sendResponse(response);
163 return;
164 }
148 var params = new protocol.SearchGetTypeHierarchyParams.fromRequest(request); 165 var params = new protocol.SearchGetTypeHierarchyParams.fromRequest(request);
149 String file = params.file; 166 String file = params.file;
150 // wait for analysis 167 // wait for analysis
151 if (params.superOnly == true) { 168 if (params.superOnly == true) {
152 await server.onFileAnalysisComplete(file); 169 await server.onFileAnalysisComplete(file);
153 } else { 170 } else {
154 await server.onAnalysisComplete; 171 await server.onAnalysisComplete;
155 } 172 }
156 // prepare element 173 // prepare element
157 List<Element> elements = server.getElementsAtOffset(file, params.offset); 174 List<Element> elements = server.getElementsAtOffset(file, params.offset);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 void _sendTypeHierarchyNull(protocol.Request request) { 245 void _sendTypeHierarchyNull(protocol.Request request) {
229 protocol.Response response = 246 protocol.Response response =
230 new protocol.SearchGetTypeHierarchyResult().toResponse(request.id); 247 new protocol.SearchGetTypeHierarchyResult().toResponse(request.id);
231 server.sendResponse(response); 248 server.sendResponse(response);
232 } 249 }
233 250
234 static protocol.SearchResult toResult(SearchMatch match) { 251 static protocol.SearchResult toResult(SearchMatch match) {
235 return protocol.newSearchResult_fromMatch(match); 252 return protocol.newSearchResult_fromMatch(match);
236 } 253 }
237 } 254 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/domain_analysis.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698