| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library domain.completion; |
| 6 |
| 7 import 'package:analysis_server/src/analysis_server.dart'; |
| 8 import 'package:analysis_server/src/constants.dart'; |
| 9 import 'package:analysis_server/src/protocol.dart'; |
| 10 |
| 11 /** |
| 12 * Instances of the class [CompletionDomainHandler] implement a [RequestHandler] |
| 13 * that handles requests in the search domain. |
| 14 */ |
| 15 class CompletionDomainHandler implements RequestHandler { |
| 16 /** |
| 17 * The analysis server that is using this handler to process requests. |
| 18 */ |
| 19 final AnalysisServer server; |
| 20 |
| 21 /** |
| 22 * Initialize a newly created handler to handle requests for the given [server
]. |
| 23 */ |
| 24 CompletionDomainHandler(this.server); |
| 25 |
| 26 @override |
| 27 Response handleRequest(Request request) { |
| 28 try { |
| 29 String requestName = request.method; |
| 30 if (requestName == COMPLETION_GET_SUGGESTIONS) { |
| 31 return getSuggestions(request); |
| 32 } |
| 33 } on RequestFailure catch (exception) { |
| 34 return exception.response; |
| 35 } |
| 36 return null; |
| 37 } |
| 38 |
| 39 Response getSuggestions(Request request) { |
| 40 // file |
| 41 RequestDatum fileDatum = request.getRequiredParameter(FILE); |
| 42 String file = fileDatum.asString(); |
| 43 // offset |
| 44 RequestDatum offsetDatum = request.getRequiredParameter(OFFSET); |
| 45 int offset = offsetDatum.asInt(); |
| 46 // TODO(brianwilkerson) implement |
| 47 return null; |
| 48 } |
| 49 } |
| OLD | NEW |