OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.manager; | 5 library services.completion.dart.manager; |
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/provisional/completion/completion_core.dart' | 10 import 'package:analysis_server/src/provisional/completion/completion_core.dart' |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 } | 304 } |
305 LibraryElement libElem = libraryElement; | 305 LibraryElement libElem = libraryElement; |
306 if (libElem == null) { | 306 if (libElem == null) { |
307 return null; | 307 return null; |
308 } | 308 } |
309 _resolvedUnits = <CompilationUnitElement>[]; | 309 _resolvedUnits = <CompilationUnitElement>[]; |
310 for (CompilationUnitElement unresolvedUnit in libElem.units) { | 310 for (CompilationUnitElement unresolvedUnit in libElem.units) { |
311 CompilationUnit unit = await _computeAsync( | 311 CompilationUnit unit = await _computeAsync( |
312 this, | 312 this, |
313 new LibrarySpecificUnit(libElem.source, unresolvedUnit.source), | 313 new LibrarySpecificUnit(libElem.source, unresolvedUnit.source), |
314 RESOLVED_UNIT4, | 314 RESOLVED_UNIT5, |
315 performance, | 315 performance, |
316 'resolve library unit'); | 316 'resolve library unit'); |
317 checkAborted(); | 317 checkAborted(); |
318 CompilationUnitElement resolvedUnit = unit?.element; | 318 CompilationUnitElement resolvedUnit = unit?.element; |
319 if (resolvedUnit != null) { | 319 if (resolvedUnit != null) { |
320 _resolvedUnits.add(resolvedUnit); | 320 _resolvedUnits.add(resolvedUnit); |
321 } | 321 } |
322 } | 322 } |
323 return _resolvedUnits; | 323 return _resolvedUnits; |
324 } | 324 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 } | 381 } |
382 } else { | 382 } else { |
383 libSource = source; | 383 libSource = source; |
384 } | 384 } |
385 | 385 |
386 // Most (all?) contributors need declarations in scope to be resolved | 386 // Most (all?) contributors need declarations in scope to be resolved |
387 if (libSource != null) { | 387 if (libSource != null) { |
388 unit = await _computeAsync( | 388 unit = await _computeAsync( |
389 request, | 389 request, |
390 new LibrarySpecificUnit(libSource, source), | 390 new LibrarySpecificUnit(libSource, source), |
391 resultDescriptor ?? RESOLVED_UNIT4, | 391 resultDescriptor ?? RESOLVED_UNIT5, |
392 performance, | 392 performance, |
393 'resolve declarations'); | 393 'resolve declarations'); |
394 } | 394 } |
395 | 395 |
396 DartCompletionRequestImpl dartRequest = new DartCompletionRequestImpl._( | 396 DartCompletionRequestImpl dartRequest = new DartCompletionRequestImpl._( |
397 request.context, | 397 request.context, |
398 request.resourceProvider, | 398 request.resourceProvider, |
399 request.searchEngine, | 399 request.searchEngine, |
400 libSource, | 400 libSource, |
401 request.source, | 401 request.source, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 if (start <= requestOffset && requestOffset <= end) { | 493 if (start <= requestOffset && requestOffset <= end) { |
494 // Replacement range for import URI | 494 // Replacement range for import URI |
495 return new ReplacementRange(start, end - start); | 495 return new ReplacementRange(start, end - start); |
496 } | 496 } |
497 } | 497 } |
498 } | 498 } |
499 } | 499 } |
500 return new ReplacementRange(requestOffset, 0); | 500 return new ReplacementRange(requestOffset, 0); |
501 } | 501 } |
502 } | 502 } |
OLD | NEW |