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

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

Issue 421123005: Update 'search.getTypeHierarchy' to the latest spec. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/search/type_hierarchy.dart » ('j') | 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/computer/element.dart' as se; 10 import 'package:analysis_server/src/computer/element.dart' as se;
11 import 'package:analysis_server/src/constants.dart'; 11 import 'package:analysis_server/src/constants.dart';
12 import 'package:analysis_server/src/protocol.dart'; 12 import 'package:analysis_server/src/protocol.dart';
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/search_result.dart'; 14 import 'package:analysis_server/src/search/search_result.dart';
15 import 'package:analysis_server/src/search/type_hierarchy.dart'; 15 import 'package:analysis_server/src/search/type_hierarchy.dart';
16 import 'package:analysis_services/constants.dart'; 16 import 'package:analysis_services/constants.dart';
17 import 'package:analysis_services/json.dart';
17 import 'package:analysis_services/search/search_engine.dart'; 18 import 'package:analysis_services/search/search_engine.dart';
18 import 'package:analyzer/src/generated/element.dart'; 19 import 'package:analyzer/src/generated/element.dart';
19 20
20 /** 21 /**
21 * Instances of the class [SearchDomainHandler] implement a [RequestHandler] 22 * Instances of the class [SearchDomainHandler] implement a [RequestHandler]
22 * that handles requests in the search domain. 23 * that handles requests in the search domain.
23 */ 24 */
24 class SearchDomainHandler implements RequestHandler { 25 class SearchDomainHandler implements RequestHandler {
25 /** 26 /**
26 * The analysis server that is using this handler to process requests. 27 * The analysis server that is using this handler to process requests.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 String file = request.getRequiredParameter(FILE).asString(); 136 String file = request.getRequiredParameter(FILE).asString();
136 int offset = request.getRequiredParameter(OFFSET).asInt(); 137 int offset = request.getRequiredParameter(OFFSET).asInt();
137 // prepare Element 138 // prepare Element
138 List<Element> elements = server.getElementsAtOffset(file, offset); 139 List<Element> elements = server.getElementsAtOffset(file, offset);
139 if (elements.isEmpty) { 140 if (elements.isEmpty) {
140 return new Response(request.id); 141 return new Response(request.id);
141 } 142 }
142 Element element = elements.first; 143 Element element = elements.first;
143 // prepare type hierarchy 144 // prepare type hierarchy
144 TypeHierarchyComputer computer = new TypeHierarchyComputer(searchEngine); 145 TypeHierarchyComputer computer = new TypeHierarchyComputer(searchEngine);
145 computer.compute(element).then((TypeHierarchyItem item) { 146 computer.compute(element).then((List<TypeHierarchyItem> items) {
146 Response response = new Response(request.id); 147 Response response = new Response(request.id);
147 response.setResult(HIERARCHY, item); 148 response.setResult(HIERARCHY_ITEMS, objectToJson(items));
148 server.sendResponse(response); 149 server.sendResponse(response);
149 }); 150 });
150 // delay response 151 // delay response
151 return Response.DELAYED_RESPONSE; 152 return Response.DELAYED_RESPONSE;
152 } 153 }
153 154
154 @override 155 @override
155 Response handleRequest(Request request) { 156 Response handleRequest(Request request) {
156 try { 157 try {
157 String requestName = request.method; 158 String requestName = request.method;
(...skipping 20 matching lines...) Expand all
178 notification.setParameter(ID, searchId); 179 notification.setParameter(ID, searchId);
179 notification.setParameter(LAST, isLast); 180 notification.setParameter(LAST, isLast);
180 notification.setParameter(RESULTS, results); 181 notification.setParameter(RESULTS, results);
181 server.sendNotification(notification); 182 server.sendNotification(notification);
182 } 183 }
183 184
184 static SearchResult toResult(SearchMatch match) { 185 static SearchResult toResult(SearchMatch match) {
185 return new SearchResult.fromMatch(match); 186 return new SearchResult.fromMatch(match);
186 } 187 }
187 } 188 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/search/type_hierarchy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698