| 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 services.completion.dart; | 5 library services.completion.dart; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
| 10 import 'package:analysis_server/src/protocol.dart'; | 10 import 'package:analysis_server/src/protocol.dart'; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 } | 176 } |
| 177 | 177 |
| 178 List<DartCompletionContributor> todo = new List.from(contributors); | 178 List<DartCompletionContributor> todo = new List.from(contributors); |
| 179 todo.removeWhere((DartCompletionContributor c) { | 179 todo.removeWhere((DartCompletionContributor c) { |
| 180 return performance.logElapseTime('computeFast ${c.runtimeType}', () { | 180 return performance.logElapseTime('computeFast ${c.runtimeType}', () { |
| 181 return c.computeFast(request); | 181 return c.computeFast(request); |
| 182 }); | 182 }); |
| 183 }); | 183 }); |
| 184 contributionSorter.sort( | 184 contributionSorter.sort( |
| 185 new OldRequestWrapper(request), request.suggestions); | 185 new OldRequestWrapper(request), request.suggestions); |
| 186 sendResults(request, todo.isEmpty); | 186 |
| 187 if (todo.isEmpty) { |
| 188 sendResults(request, todo.isEmpty); |
| 189 } |
| 187 return todo; | 190 return todo; |
| 188 }); | 191 }); |
| 189 } | 192 } |
| 190 | 193 |
| 191 /** | 194 /** |
| 192 * If there is remaining work to be done, then wait for the unit to be | 195 * If there is remaining work to be done, then wait for the unit to be |
| 193 * resolved and request that each remaining contributor finish their work. | 196 * resolved and request that each remaining contributor finish their work. |
| 194 * Return a [Future] that completes when the last notification has been sent. | 197 * Return a [Future] that completes when the last notification has been sent. |
| 195 */ | 198 */ |
| 196 Future computeFull(DartCompletionRequest request, | 199 Future computeFull(DartCompletionRequest request, |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 490 |
| 488 @override | 491 @override |
| 489 CompletionTarget get target => request.target; | 492 CompletionTarget get target => request.target; |
| 490 | 493 |
| 491 @override | 494 @override |
| 492 CompilationUnit get unit => request.unit; | 495 CompilationUnit get unit => request.unit; |
| 493 | 496 |
| 494 @override | 497 @override |
| 495 String toString() => 'wrapped $request'; | 498 String toString() => 'wrapped $request'; |
| 496 } | 499 } |
| OLD | NEW |