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

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

Issue 480823005: Do proper JSON conversion when returning search results. (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 | 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/computer/element.dart' as se; 10 import 'package:analysis_server/src/computer/element.dart' as se;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if (elements.isEmpty) { 73 if (elements.isEmpty) {
74 new Future.microtask(() { 74 new Future.microtask(() {
75 _sendSearchNotification(searchId, true, []); 75 _sendSearchNotification(searchId, true, []);
76 }); 76 });
77 } 77 }
78 // respond 78 // respond
79 Response response = new Response(request.id); 79 Response response = new Response(request.id);
80 response.setResult(ID, searchId); 80 response.setResult(ID, searchId);
81 if (elements.isNotEmpty) { 81 if (elements.isNotEmpty) {
82 var serverElement = new se.Element.fromEngine(elements[0]); 82 var serverElement = new se.Element.fromEngine(elements[0]);
83 response.setResult(ELEMENT, serverElement); 83 response.setResult(ELEMENT, objectToJson(serverElement));
84 } 84 }
85 return response; 85 return response;
86 } 86 }
87 87
88 Response findMemberDeclarations(Request request) { 88 Response findMemberDeclarations(Request request) {
89 String name = request.getRequiredParameter(NAME).asString(); 89 String name = request.getRequiredParameter(NAME).asString();
90 // schedule search 90 // schedule search
91 String searchId = (_nextSearchId++).toString(); 91 String searchId = (_nextSearchId++).toString();
92 { 92 {
93 var matchesFuture = searchEngine.searchMemberDeclarations(name); 93 var matchesFuture = searchEngine.searchMemberDeclarations(name);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 return exception.response; 175 return exception.response;
176 } 176 }
177 return null; 177 return null;
178 } 178 }
179 179
180 void _sendSearchNotification(String searchId, bool isLast, 180 void _sendSearchNotification(String searchId, bool isLast,
181 Iterable<SearchResult> results) { 181 Iterable<SearchResult> results) {
182 Notification notification = new Notification(SEARCH_RESULTS); 182 Notification notification = new Notification(SEARCH_RESULTS);
183 notification.setParameter(ID, searchId); 183 notification.setParameter(ID, searchId);
184 notification.setParameter(LAST, isLast); 184 notification.setParameter(LAST, isLast);
185 notification.setParameter(RESULTS, results); 185 notification.setParameter(RESULTS, objectToJson(results));
186 server.sendNotification(notification); 186 server.sendNotification(notification);
187 } 187 }
188 188
189 static SearchResult toResult(SearchMatch match) { 189 static SearchResult toResult(SearchMatch match) {
190 return new SearchResult.fromMatch(match); 190 return new SearchResult.fromMatch(match);
191 } 191 }
192 } 192 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698