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

Side by Side Diff: pkg/analysis_server/lib/src/get_handler.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 analysis_server.src.get_handler; 5 library analysis_server.src.get_handler;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 /** 860 /**
861 * Return a response containing information about elements with the given 861 * Return a response containing information about elements with the given
862 * name. 862 * name.
863 */ 863 */
864 Future _returnIndexElementByName(HttpRequest request) async { 864 Future _returnIndexElementByName(HttpRequest request) async {
865 AnalysisServer analysisServer = _server.analysisServer; 865 AnalysisServer analysisServer = _server.analysisServer;
866 if (analysisServer == null) { 866 if (analysisServer == null) {
867 return _returnFailure(request, 'Analysis server not running'); 867 return _returnFailure(request, 'Analysis server not running');
868 } 868 }
869 Index index = analysisServer.index; 869 Index index = analysisServer.index;
870 if (index == null) {
871 return _returnFailure(request, 'Indexing is disabled');
872 }
870 String name = request.uri.queryParameters[INDEX_ELEMENT_NAME]; 873 String name = request.uri.queryParameters[INDEX_ELEMENT_NAME];
871 if (name == null) { 874 if (name == null) {
872 return _returnFailure( 875 return _returnFailure(
873 request, 876 request,
874 'Query parameter $INDEX_ELEMENT_NAME required'); 877 'Query parameter $INDEX_ELEMENT_NAME required');
875 } 878 }
876 if (index is LocalIndex) { 879 if (index is LocalIndex) {
877 Map<List<String>, List<InspectLocation>> relations = 880 Map<List<String>, List<InspectLocation>> relations =
878 await index.findElementsByName(name); 881 await index.findElementsByName(name);
879 _writeResponse(request, (StringBuffer buffer) { 882 _writeResponse(request, (StringBuffer buffer) {
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 * 'error'. 1627 * 'error'.
1625 */ 1628 */
1626 static String makeLink(String path, Map<String, String> params, 1629 static String makeLink(String path, Map<String, String> params,
1627 String innerHtml, [bool hasError = false]) { 1630 String innerHtml, [bool hasError = false]) {
1628 Uri uri = new Uri(path: path, queryParameters: params); 1631 Uri uri = new Uri(path: path, queryParameters: params);
1629 String href = HTML_ESCAPE.convert(uri.toString()); 1632 String href = HTML_ESCAPE.convert(uri.toString());
1630 String classAttribute = hasError ? ' class="error"' : ''; 1633 String classAttribute = hasError ? ' class="error"' : '';
1631 return '<a href="$href"$classAttribute>$innerHtml</a>'; 1634 return '<a href="$href"$classAttribute>$innerHtml</a>';
1632 } 1635 }
1633 } 1636 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698