| OLD | NEW |
| 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 domain.completion; | 5 library domain.completion; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/protocol/protocol.dart'; | 9 import 'package:analysis_server/protocol/protocol.dart'; |
| 10 import 'package:analysis_server/protocol/protocol_generated.dart'; | 10 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 132 } |
| 133 // | 133 // |
| 134 // Return the result. | 134 // Return the result. |
| 135 // | 135 // |
| 136 return new CompletionResult( | 136 return new CompletionResult( |
| 137 request.replacementOffset, request.replacementLength, suggestions); | 137 request.replacementOffset, request.replacementLength, suggestions); |
| 138 } | 138 } |
| 139 | 139 |
| 140 @override | 140 @override |
| 141 Response handleRequest(Request request) { | 141 Response handleRequest(Request request) { |
| 142 if (server.searchEngine == null) { | |
| 143 return new Response.noIndexGenerated(request); | |
| 144 } | |
| 145 return runZoned(() { | 142 return runZoned(() { |
| 146 String requestName = request.method; | 143 String requestName = request.method; |
| 147 if (requestName == COMPLETION_GET_SUGGESTIONS) { | 144 if (requestName == COMPLETION_GET_SUGGESTIONS) { |
| 148 processRequest(request); | 145 processRequest(request); |
| 149 return Response.DELAYED_RESPONSE; | 146 return Response.DELAYED_RESPONSE; |
| 150 } | 147 } |
| 151 return null; | 148 return null; |
| 152 }, onError: (exception, stackTrace) { | 149 }, onError: (exception, stackTrace) { |
| 153 server.sendServerErrorNotification( | 150 server.sendServerErrorNotification( |
| 154 'Failed to handle completion domain request: ${request.toJson()}', | 151 'Failed to handle completion domain request: ${request.toJson()}', |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 final int replacementOffset; | 325 final int replacementOffset; |
| 329 | 326 |
| 330 /** | 327 /** |
| 331 * The suggested completions. | 328 * The suggested completions. |
| 332 */ | 329 */ |
| 333 final List<CompletionSuggestion> suggestions; | 330 final List<CompletionSuggestion> suggestions; |
| 334 | 331 |
| 335 CompletionResult( | 332 CompletionResult( |
| 336 this.replacementOffset, this.replacementLength, this.suggestions); | 333 this.replacementOffset, this.replacementLength, this.suggestions); |
| 337 } | 334 } |
| OLD | NEW |