| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) { | 105 if (server.options.enableNewAnalysisDriver) { |
| 106 // TODO(scheglov) implement for the new analysis driver | 106 // TODO(scheglov) implement for the new analysis driver |
| 107 return new CompletionGetSuggestionsResult('0').toResponse(request.id); | 107 String completionId = (_nextCompletionId++).toString(); |
| 108 new Future(() { |
| 109 sendCompletionNotification(completionId, 0, 0, []); |
| 110 }); |
| 111 return new CompletionGetSuggestionsResult(completionId) |
| 112 .toResponse(request.id); |
| 108 } | 113 } |
| 109 if (server.searchEngine == null) { | 114 if (server.searchEngine == null) { |
| 110 return new Response.noIndexGenerated(request); | 115 return new Response.noIndexGenerated(request); |
| 111 } | 116 } |
| 112 return runZoned(() { | 117 return runZoned(() { |
| 113 try { | 118 try { |
| 114 String requestName = request.method; | 119 String requestName = request.method; |
| 115 if (requestName == COMPLETION_GET_SUGGESTIONS) { | 120 if (requestName == COMPLETION_GET_SUGGESTIONS) { |
| 116 return processRequest(request); | 121 return processRequest(request); |
| 117 } | 122 } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 final int replacementOffset; | 256 final int replacementOffset; |
| 252 | 257 |
| 253 /** | 258 /** |
| 254 * The suggested completions. | 259 * The suggested completions. |
| 255 */ | 260 */ |
| 256 final List<CompletionSuggestion> suggestions; | 261 final List<CompletionSuggestion> suggestions; |
| 257 | 262 |
| 258 CompletionResult( | 263 CompletionResult( |
| 259 this.replacementOffset, this.replacementLength, this.suggestions); | 264 this.replacementOffset, this.replacementLength, this.suggestions); |
| 260 } | 265 } |
| OLD | NEW |