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 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/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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 } | 174 } |
| 175 } | 175 } |
| 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 // TODO(danrubel) Process the AnalysisRequest returned by the |
| 185 new OldRequestWrapper(request), request.suggestions); | 185 // contribution sorter. At this point, the target unit has been fully |
| 186 // resolved, thus no need for additional resolution, but in the future... | |
| 187 contributionSorter.sort(request, request.suggestions); | |
|
Brian Wilkerson
2015/11/14 16:59:24
Given that this one line will turn into multiple l
danrubel
2015/11/17 06:58:45
Good point. I'll address that in a subsequent CL.
danrubel
2015/11/17 23:12:54
https://codereview.chromium.org/1449333002/
| |
| 186 | 188 |
| 187 if (todo.isEmpty) { | 189 if (todo.isEmpty) { |
| 188 sendResults(request, todo.isEmpty); | 190 sendResults(request, todo.isEmpty); |
| 189 } | 191 } |
| 190 return todo; | 192 return todo; |
| 191 }); | 193 }); |
| 192 } | 194 } |
| 193 | 195 |
| 194 /** | 196 /** |
| 195 * If there is remaining work to be done, then wait for the unit to be | 197 * If there is remaining work to be done, then wait for the unit to be |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 216 int count = todo.length; | 218 int count = todo.length; |
| 217 todo.forEach((DartCompletionContributor c) { | 219 todo.forEach((DartCompletionContributor c) { |
| 218 String name = c.runtimeType.toString(); | 220 String name = c.runtimeType.toString(); |
| 219 String completeTag = 'computeFull $name complete'; | 221 String completeTag = 'computeFull $name complete'; |
| 220 performance.logStartTime(completeTag); | 222 performance.logStartTime(completeTag); |
| 221 performance.logElapseTime('computeFull $name', () { | 223 performance.logElapseTime('computeFull $name', () { |
| 222 c.computeFull(request).then((bool changed) { | 224 c.computeFull(request).then((bool changed) { |
| 223 performance.logElapseTime(completeTag); | 225 performance.logElapseTime(completeTag); |
| 224 bool last = --count == 0; | 226 bool last = --count == 0; |
| 225 if (changed || last) { | 227 if (changed || last) { |
| 226 contributionSorter.sort( | 228 // TODO(danrubel) Process the AnalysisRequest returned by the |
| 227 new OldRequestWrapper(request), request.suggestions); | 229 // contribution sorter. At this point, the target unit has been |
| 230 // fully resolved, thus no need for additional resolution, | |
| 231 // but in the future... | |
| 232 contributionSorter.sort(request, request.suggestions); | |
| 228 sendResults(request, last); | 233 sendResults(request, last); |
| 229 } | 234 } |
| 230 }); | 235 }); |
| 231 }); | 236 }); |
| 232 }); | 237 }); |
| 233 }); | 238 }); |
| 234 }); | 239 }); |
| 235 } | 240 } |
| 236 | 241 |
| 237 @override | 242 @override |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 490 | 495 |
| 491 @override | 496 @override |
| 492 CompletionTarget get target => request.target; | 497 CompletionTarget get target => request.target; |
| 493 | 498 |
| 494 @override | 499 @override |
| 495 CompilationUnit get unit => request.unit; | 500 CompilationUnit get unit => request.unit; |
| 496 | 501 |
| 497 @override | 502 @override |
| 498 String toString() => 'wrapped $request'; | 503 String toString() => 'wrapped $request'; |
| 499 } | 504 } |
| OLD | NEW |