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

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

Issue 923103004: Return RequestErrorCode.NO_INDEX_GENERATED for search/refactoring requests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 months 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 | Annotate | Revision Log
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';
11 import 'package:analysis_server/src/protocol_server.dart' as protocol; 11 import 'package:analysis_server/src/protocol_server.dart' as protocol;
12 import 'package:analysis_server/src/search/element_references.dart'; 12 import 'package:analysis_server/src/search/element_references.dart';
13 import 'package:analysis_server/src/search/type_hierarchy.dart'; 13 import 'package:analysis_server/src/search/type_hierarchy.dart';
14 import 'package:analysis_server/src/services/search/search_engine.dart'; 14 import 'package:analysis_server/src/services/search/search_engine.dart';
15 import 'package:analyzer/src/generated/element.dart'; 15 import 'package:analyzer/src/generated/element.dart';
16 16
17
17 /** 18 /**
18 * Instances of the class [SearchDomainHandler] implement a [RequestHandler] 19 * Instances of the class [SearchDomainHandler] implement a [RequestHandler]
19 * that handles requests in the search domain. 20 * that handles requests in the search domain.
20 */ 21 */
21 class SearchDomainHandler implements protocol.RequestHandler { 22 class SearchDomainHandler implements protocol.RequestHandler {
22 /** 23 /**
23 * The analysis server that is using this handler to process requests. 24 * The analysis server that is using this handler to process requests.
24 */ 25 */
25 final AnalysisServer server; 26 final AnalysisServer server;
26 27
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // prepare type hierarchy 145 // prepare type hierarchy
145 TypeHierarchyComputer computer = new TypeHierarchyComputer(searchEngine); 146 TypeHierarchyComputer computer = new TypeHierarchyComputer(searchEngine);
146 List<protocol.TypeHierarchyItem> items = await computer.compute(element); 147 List<protocol.TypeHierarchyItem> items = await computer.compute(element);
147 protocol.Response response = new protocol.SearchGetTypeHierarchyResult( 148 protocol.Response response = new protocol.SearchGetTypeHierarchyResult(
148 hierarchyItems: items).toResponse(request.id); 149 hierarchyItems: items).toResponse(request.id);
149 server.sendResponse(response); 150 server.sendResponse(response);
150 } 151 }
151 152
152 @override 153 @override
153 protocol.Response handleRequest(protocol.Request request) { 154 protocol.Response handleRequest(protocol.Request request) {
155 if (searchEngine == null) {
156 return new protocol.Response.noIndexGenerated(request);
157 }
154 try { 158 try {
155 String requestName = request.method; 159 String requestName = request.method;
156 if (requestName == SEARCH_FIND_ELEMENT_REFERENCES) { 160 if (requestName == SEARCH_FIND_ELEMENT_REFERENCES) {
157 findElementReferences(request); 161 findElementReferences(request);
158 return protocol.Response.DELAYED_RESPONSE; 162 return protocol.Response.DELAYED_RESPONSE;
159 } else if (requestName == SEARCH_FIND_MEMBER_DECLARATIONS) { 163 } else if (requestName == SEARCH_FIND_MEMBER_DECLARATIONS) {
160 findMemberDeclarations(request); 164 findMemberDeclarations(request);
161 return protocol.Response.DELAYED_RESPONSE; 165 return protocol.Response.DELAYED_RESPONSE;
162 } else if (requestName == SEARCH_FIND_MEMBER_REFERENCES) { 166 } else if (requestName == SEARCH_FIND_MEMBER_REFERENCES) {
163 findMemberReferences(request); 167 findMemberReferences(request);
(...skipping 25 matching lines...) Expand all
189 */ 193 */
190 void _sendSearchResult(protocol.Request request, result) { 194 void _sendSearchResult(protocol.Request request, result) {
191 protocol.Response response = result.toResponse(request.id); 195 protocol.Response response = result.toResponse(request.id);
192 server.sendResponse(response); 196 server.sendResponse(response);
193 } 197 }
194 198
195 static protocol.SearchResult toResult(SearchMatch match) { 199 static protocol.SearchResult toResult(SearchMatch match) {
196 return protocol.newSearchResult_fromMatch(match); 200 return protocol.newSearchResult_fromMatch(match);
197 } 201 }
198 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698