| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 if (params.offset < 0 || params.offset > contents.data.length) { | 132 if (params.offset < 0 || params.offset > contents.data.length) { |
| 133 return new Response.invalidParameter( | 133 return new Response.invalidParameter( |
| 134 request, | 134 request, |
| 135 'params.offset', | 135 'params.offset', |
| 136 'Expected offset between 0 and source length inclusive,' | 136 'Expected offset between 0 and source length inclusive,' |
| 137 ' but found ${params.offset}'); | 137 ' but found ${params.offset}'); |
| 138 } | 138 } |
| 139 | 139 |
| 140 recordRequest(performance, context, source, params.offset); | 140 recordRequest(performance, context, source, params.offset); |
| 141 | 141 |
| 142 CompletionRequest completionRequest = new CompletionRequestImpl(context, | 142 CompletionRequest completionRequest = new CompletionRequestImpl( |
| 143 server.resourceProvider, server.searchEngine, source, params.offset); | 143 context, |
| 144 server.resourceProvider, |
| 145 server.searchEngine, |
| 146 source, |
| 147 params.offset, |
| 148 performance); |
| 144 String completionId = (_nextCompletionId++).toString(); | 149 String completionId = (_nextCompletionId++).toString(); |
| 145 | 150 |
| 146 // Compute suggestions in the background | 151 // Compute suggestions in the background |
| 147 computeSuggestions(completionRequest).then((CompletionResult result) { | 152 computeSuggestions(completionRequest).then((CompletionResult result) { |
| 148 const SEND_NOTIFICATION_TAG = 'send notification'; | 153 const SEND_NOTIFICATION_TAG = 'send notification'; |
| 149 performance.logStartTime(SEND_NOTIFICATION_TAG); | 154 performance.logStartTime(SEND_NOTIFICATION_TAG); |
| 150 sendCompletionNotification(completionId, result.replacementOffset, | 155 sendCompletionNotification(completionId, result.replacementOffset, |
| 151 result.replacementLength, result.suggestions); | 156 result.replacementLength, result.suggestions); |
| 152 performance.logElapseTime(SEND_NOTIFICATION_TAG); | 157 performance.logElapseTime(SEND_NOTIFICATION_TAG); |
| 153 | 158 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 final int replacementOffset; | 220 final int replacementOffset; |
| 216 | 221 |
| 217 /** | 222 /** |
| 218 * The suggested completions. | 223 * The suggested completions. |
| 219 */ | 224 */ |
| 220 final List<CompletionSuggestion> suggestions; | 225 final List<CompletionSuggestion> suggestions; |
| 221 | 226 |
| 222 CompletionResult( | 227 CompletionResult( |
| 223 this.replacementOffset, this.replacementLength, this.suggestions); | 228 this.replacementOffset, this.replacementLength, this.suggestions); |
| 224 } | 229 } |
| OLD | NEW |