| 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/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:analysis_server/src/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // TODO (danrubel) if request is obsolete | 95 // TODO (danrubel) if request is obsolete |
| 96 // (processAnalysisRequest returns false) | 96 // (processAnalysisRequest returns false) |
| 97 // then send empty results | 97 // then send empty results |
| 98 | 98 |
| 99 return new CompletionResult( | 99 return new CompletionResult( |
| 100 request.replacementOffset, request.replacementLength, suggestions); | 100 request.replacementOffset, request.replacementLength, suggestions); |
| 101 } | 101 } |
| 102 | 102 |
| 103 @override | 103 @override |
| 104 Response handleRequest(Request request) { | 104 Response handleRequest(Request request) { |
| 105 if (server.options.enableNewAnalysisDriver) { |
| 106 // TODO(scheglov) implement for the new analysis driver |
| 107 return new CompletionGetSuggestionsResult('0').toResponse(request.id); |
| 108 } |
| 105 if (server.searchEngine == null) { | 109 if (server.searchEngine == null) { |
| 106 return new Response.noIndexGenerated(request); | 110 return new Response.noIndexGenerated(request); |
| 107 } | 111 } |
| 108 return runZoned(() { | 112 return runZoned(() { |
| 109 try { | 113 try { |
| 110 String requestName = request.method; | 114 String requestName = request.method; |
| 111 if (requestName == COMPLETION_GET_SUGGESTIONS) { | 115 if (requestName == COMPLETION_GET_SUGGESTIONS) { |
| 112 return processRequest(request); | 116 return processRequest(request); |
| 113 } | 117 } |
| 114 } on RequestFailure catch (exception) { | 118 } on RequestFailure catch (exception) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 final int replacementOffset; | 251 final int replacementOffset; |
| 248 | 252 |
| 249 /** | 253 /** |
| 250 * The suggested completions. | 254 * The suggested completions. |
| 251 */ | 255 */ |
| 252 final List<CompletionSuggestion> suggestions; | 256 final List<CompletionSuggestion> suggestions; |
| 253 | 257 |
| 254 CompletionResult( | 258 CompletionResult( |
| 255 this.replacementOffset, this.replacementLength, this.suggestions); | 259 this.replacementOffset, this.replacementLength, this.suggestions); |
| 256 } | 260 } |
| OLD | NEW |