| 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' |
| 11 show CompletionContributor, CompletionRequest; | 11 show CompletionContributor, CompletionRequest; |
| 12 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 12 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
| 13 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi
n.dart'; | 13 import 'package:analysis_server/src/provisional/completion/dart/completion_plugi
n.dart'; |
| 14 import 'package:analysis_server/src/provisional/completion/dart/completion_targe
t.dart'; | 14 import 'package:analysis_server/src/provisional/completion/dart/completion_targe
t.dart'; |
| 15 import 'package:analysis_server/src/services/completion/completion_core.dart'; | 15 import 'package:analysis_server/src/services/completion/completion_core.dart'; |
| 16 import 'package:analysis_server/src/services/completion/completion_performance.d
art'; | 16 import 'package:analysis_server/src/services/completion/completion_performance.d
art'; |
| 17 import 'package:analysis_server/src/services/completion/dart/common_usage_sorter
.dart'; | 17 import 'package:analysis_server/src/services/completion/dart/common_usage_sorter
.dart'; |
| 18 import 'package:analysis_server/src/services/completion/dart/contribution_sorter
.dart'; | 18 import 'package:analysis_server/src/services/completion/dart/contribution_sorter
.dart'; |
| 19 import 'package:analysis_server/src/services/completion/dart/optype.dart'; | 19 import 'package:analysis_server/src/services/completion/dart/optype.dart'; |
| 20 import 'package:analysis_server/src/services/search/search_engine.dart'; | 20 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 21 import 'package:analyzer/dart/ast/ast.dart'; | 21 import 'package:analyzer/dart/ast/ast.dart'; |
| 22 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; |
| 22 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 23 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| 23 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; | |
| 24 import 'package:analyzer/dart/ast/token.dart'; | 24 import 'package:analyzer/dart/ast/token.dart'; |
| 25 import 'package:analyzer/dart/element/element.dart'; | 25 import 'package:analyzer/dart/element/element.dart'; |
| 26 import 'package:analyzer/dart/element/type.dart'; | 26 import 'package:analyzer/dart/element/type.dart'; |
| 27 import 'package:analyzer/exception/exception.dart'; | 27 import 'package:analyzer/exception/exception.dart'; |
| 28 import 'package:analyzer/file_system/file_system.dart'; | 28 import 'package:analyzer/file_system/file_system.dart'; |
| 29 import 'package:analyzer/src/context/context.dart' show AnalysisFutureHelper; | 29 import 'package:analyzer/src/context/context.dart' show AnalysisFutureHelper; |
| 30 import 'package:analyzer/src/dart/analysis/driver.dart'; | 30 import 'package:analyzer/src/dart/analysis/driver.dart'; |
| 31 import 'package:analyzer/src/dart/ast/token.dart'; | 31 import 'package:analyzer/src/dart/ast/token.dart'; |
| 32 import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult; | 32 import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult; |
| 33 import 'package:analyzer/src/generated/source.dart'; | 33 import 'package:analyzer/src/generated/source.dart'; |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 @override | 301 @override |
| 302 Future<List<ImportElement>> resolveImports() async { | 302 Future<List<ImportElement>> resolveImports() async { |
| 303 checkAborted(); | 303 checkAborted(); |
| 304 if (_resolvedImports != null) { | 304 if (_resolvedImports != null) { |
| 305 return _resolvedImports; | 305 return _resolvedImports; |
| 306 } | 306 } |
| 307 LibraryElement libElem = libraryElement; | 307 LibraryElement libElem = libraryElement; |
| 308 if (libElem == null) { | 308 if (libElem == null) { |
| 309 return null; | 309 return null; |
| 310 } | 310 } |
| 311 _resolvedImports = <ImportElement>[]; | 311 if (result != null) { |
| 312 for (ImportElement importElem in libElem.imports) { | 312 _resolvedImports = libElem.imports; |
| 313 if (importElem.importedLibrary?.exportNamespace == null) { | 313 } else { |
| 314 await _computeAsync(this, importElem.importedLibrary.source, | 314 _resolvedImports = <ImportElement>[]; |
| 315 LIBRARY_ELEMENT4, performance, 'resolve imported library'); | 315 for (ImportElement importElem in libElem.imports) { |
| 316 checkAborted(); | 316 if (importElem.importedLibrary?.exportNamespace == null) { |
| 317 await _computeAsync(this, importElem.importedLibrary.source, |
| 318 LIBRARY_ELEMENT4, performance, 'resolve imported library'); |
| 319 checkAborted(); |
| 320 } |
| 321 _resolvedImports.add(importElem); |
| 317 } | 322 } |
| 318 _resolvedImports.add(importElem); | |
| 319 } | 323 } |
| 320 return _resolvedImports; | 324 return _resolvedImports; |
| 321 } | 325 } |
| 322 | 326 |
| 323 @override | 327 @override |
| 324 Future<List<CompilationUnitElement>> resolveUnits() async { | 328 Future<List<CompilationUnitElement>> resolveUnits() async { |
| 325 checkAborted(); | 329 checkAborted(); |
| 326 if (_resolvedUnits != null) { | 330 if (_resolvedUnits != null) { |
| 327 return _resolvedUnits; | 331 return _resolvedUnits; |
| 328 } | 332 } |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 if (start <= requestOffset && requestOffset <= end) { | 537 if (start <= requestOffset && requestOffset <= end) { |
| 534 // Replacement range for import URI | 538 // Replacement range for import URI |
| 535 return new ReplacementRange(start, end - start); | 539 return new ReplacementRange(start, end - start); |
| 536 } | 540 } |
| 537 } | 541 } |
| 538 } | 542 } |
| 539 } | 543 } |
| 540 return new ReplacementRange(requestOffset, 0); | 544 return new ReplacementRange(requestOffset, 0); |
| 541 } | 545 } |
| 542 } | 546 } |
| OLD | NEW |