Chromium Code Reviews| Index: pkg/analysis_server/lib/src/search/search_domain.dart |
| diff --git a/pkg/analysis_server/lib/src/search/search_domain.dart b/pkg/analysis_server/lib/src/search/search_domain.dart |
| index 4a0e1b7a4eed93d1bc69f3b069862cf01f2f5fa5..f72b2962b6a689af46cf3284283c9e94e8183af6 100644 |
| --- a/pkg/analysis_server/lib/src/search/search_domain.dart |
| +++ b/pkg/analysis_server/lib/src/search/search_domain.dart |
| @@ -115,18 +115,28 @@ class SearchDomainHandler implements protocol.RequestHandler { |
| _sendSearchNotification(searchId, true, matches.map(toResult)); |
| } |
| - Future findTopLevelDeclarations(protocol.Request request) async { |
| + void findTopLevelDeclarations(protocol.Request request) { |
|
Brian Wilkerson
2016/07/13 23:42:37
Removing the `async` makes this much harder to rea
scheglov
2016/07/14 00:18:07
We could use something like this instead.
()
|
| var params = |
| new protocol.SearchFindTopLevelDeclarationsParams.fromRequest(request); |
| - await server.onAnalysisComplete; |
| - // respond |
| - String searchId = (_nextSearchId++).toString(); |
| - _sendSearchResult( |
| - request, new protocol.SearchFindTopLevelDeclarationsResult(searchId)); |
| - // search |
| - List<SearchMatch> matches = |
| - await searchEngine.searchTopLevelDeclarations(params.pattern); |
| - _sendSearchNotification(searchId, true, matches.map(toResult)); |
| + try { |
| + new RegExp(params.pattern); |
| + } on FormatException catch (exception) { |
| + throw new protocol.RequestFailure(new protocol.Response.invalidParameter( |
| + request, 'pattern', exception.message)); |
| + } |
| + |
| + server.onAnalysisComplete.then((_) { |
| + // respond |
| + String searchId = (_nextSearchId++).toString(); |
| + _sendSearchResult( |
| + request, new protocol.SearchFindTopLevelDeclarationsResult(searchId)); |
| + // search |
| + searchEngine |
| + .searchTopLevelDeclarations(params.pattern) |
| + .then((List<SearchMatch> matches) { |
| + _sendSearchNotification(searchId, true, matches.map(toResult)); |
| + }); |
| + }); |
| } |
| /** |