Chromium Code Reviews| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/protocol/protocol.dart'; | 7 import 'package:analysis_server/protocol/protocol.dart'; |
| 8 import 'package:analysis_server/protocol/protocol_generated.dart'; | 8 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
| 10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 | 114 |
| 115 // | 115 // |
| 116 // Add the fixes produced by plugins to the server-generated fixes. | 116 // Add the fixes produced by plugins to the server-generated fixes. |
| 117 // | 117 // |
| 118 if (pluginFutures != null) { | 118 if (pluginFutures != null) { |
| 119 List<plugin.Response> responses = await waitForResponses(pluginFutures, | 119 List<plugin.Response> responses = await waitForResponses(pluginFutures, |
| 120 requestParameters: requestParams); | 120 requestParameters: requestParams); |
| 121 for (plugin.Response response in responses) { | 121 for (plugin.Response response in responses) { |
| 122 plugin.CompletionGetSuggestionsResult result = | 122 plugin.CompletionGetSuggestionsResult result = |
| 123 new plugin.CompletionGetSuggestionsResult.fromResponse(response); | 123 new plugin.CompletionGetSuggestionsResult.fromResponse(response); |
| 124 if (suggestions.isEmpty) { | |
| 125 request.replacementOffset = result.replacementOffset; | |
| 126 request.replacementLength = result.replacementLength; | |
|
Brian Wilkerson
2017/05/30 18:30:22
I think we only want to overwrite the current valu
maxkim
2017/05/30 19:10:32
Adding the null-aware assignment is making the rep
Brian Wilkerson
2017/05/30 19:18:48
I'm probably just being too cautious. I'm willing
| |
| 127 } else if (request.replacementOffset != result.replacementOffset && | |
| 128 request.replacementLength != result.replacementLength) { | |
| 129 server.instrumentationService | |
| 130 .logError('Plugin completion-results dropped due to conflicting' | |
| 131 ' replacement offset/length: ${result.toJson()}'); | |
| 132 continue; | |
| 133 } | |
| 124 suggestions.addAll(result.results); | 134 suggestions.addAll(result.results); |
| 125 } | 135 } |
| 126 } | 136 } |
| 127 // | 137 // |
| 128 // Return the result. | 138 // Return the result. |
| 129 // | 139 // |
| 130 return new CompletionResult( | 140 return new CompletionResult( |
| 131 request.replacementOffset, request.replacementLength, suggestions); | 141 request.replacementOffset, request.replacementLength, suggestions); |
| 132 } | 142 } |
| 133 | 143 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 288 final int replacementOffset; | 298 final int replacementOffset; |
| 289 | 299 |
| 290 /** | 300 /** |
| 291 * The suggested completions. | 301 * The suggested completions. |
| 292 */ | 302 */ |
| 293 final List<CompletionSuggestion> suggestions; | 303 final List<CompletionSuggestion> suggestions; |
| 294 | 304 |
| 295 CompletionResult( | 305 CompletionResult( |
| 296 this.replacementOffset, this.replacementLength, this.suggestions); | 306 this.replacementOffset, this.replacementLength, this.suggestions); |
| 297 } | 307 } |
| OLD | NEW |