| 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/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
| 10 import 'package:analysis_server/src/services/completion/arglist_computer.dart'; | 10 import 'package:analysis_server/src/services/completion/arglist_computer.dart'; |
| 11 import 'package:analysis_server/src/services/completion/combinator_computer.dart
'; | 11 import 'package:analysis_server/src/services/completion/combinator_computer.dart
'; |
| 12 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; | 12 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; |
| 13 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; |
| 13 import 'package:analysis_server/src/services/completion/imported_computer.dart'; | 14 import 'package:analysis_server/src/services/completion/imported_computer.dart'; |
| 14 import 'package:analysis_server/src/services/completion/invocation_computer.dart
'; | 15 import 'package:analysis_server/src/services/completion/invocation_computer.dart
'; |
| 15 import 'package:analysis_server/src/services/completion/keyword_computer.dart'; | 16 import 'package:analysis_server/src/services/completion/keyword_computer.dart'; |
| 16 import 'package:analysis_server/src/services/completion/local_computer.dart'; | 17 import 'package:analysis_server/src/services/completion/local_computer.dart'; |
| 17 import 'package:analysis_server/src/services/search/search_engine.dart'; | 18 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 18 import 'package:analyzer/src/generated/ast.dart'; | 19 import 'package:analyzer/src/generated/ast.dart'; |
| 19 import 'package:analyzer/src/generated/element.dart'; | 20 import 'package:analyzer/src/generated/element.dart'; |
| 20 import 'package:analyzer/src/generated/engine.dart'; | 21 import 'package:analyzer/src/generated/engine.dart'; |
| 21 import 'package:analyzer/src/generated/source.dart'; | 22 import 'package:analyzer/src/generated/source.dart'; |
| 22 | 23 |
| 23 /** | 24 /** |
| 24 * The `DartCompletionCache` contains cached information from a prior code | |
| 25 * completion operation. | |
| 26 */ | |
| 27 class DartCompletionCache extends CompletionCache { | |
| 28 | |
| 29 /** | |
| 30 * A hash of the import directives. | |
| 31 */ | |
| 32 String importKey; | |
| 33 | |
| 34 /** | |
| 35 * Library prefix suggestions based upon imports, | |
| 36 * or `null` if nothing has been cached. | |
| 37 */ | |
| 38 List<CompletionSuggestion> libraryPrefixSuggestions; | |
| 39 | |
| 40 /** | |
| 41 * Type suggestions based upon imports, | |
| 42 * or `null` if nothing has been cached. | |
| 43 */ | |
| 44 List<CompletionSuggestion> importedTypeSuggestions; | |
| 45 | |
| 46 /** | |
| 47 * Suggestions for methods and functions that have void return type, | |
| 48 * or `null` if nothing has been cached. | |
| 49 */ | |
| 50 List<CompletionSuggestion> importedVoidReturnSuggestions; | |
| 51 | |
| 52 /** | |
| 53 * Other suggestions based upon imports, | |
| 54 * or `null` if nothing has been cached. | |
| 55 */ | |
| 56 List<CompletionSuggestion> otherImportedSuggestions; | |
| 57 | |
| 58 DartCompletionCache(AnalysisContext context, Source source) | |
| 59 : super(context, source); | |
| 60 } | |
| 61 | |
| 62 /** | |
| 63 * The base class for computing code completion suggestions. | 25 * The base class for computing code completion suggestions. |
| 64 */ | 26 */ |
| 65 abstract class DartCompletionComputer { | 27 abstract class DartCompletionComputer { |
| 66 /** | 28 /** |
| 67 * Computes the initial set of [CompletionSuggestion]s based on | 29 * Computes the initial set of [CompletionSuggestion]s based on |
| 68 * the given completion context. The compilation unit and completion node | 30 * the given completion context. The compilation unit and completion node |
| 69 * in the given completion context may not be resolved. | 31 * in the given completion context may not be resolved. |
| 70 * This method should execute quickly and not block waiting for any analysis. | 32 * This method should execute quickly and not block waiting for any analysis. |
| 71 * Returns `true` if the computer's work is complete | 33 * Returns `true` if the computer's work is complete |
| 72 * or `false` if [computeFull] should be called to complete the work. | 34 * or `false` if [computeFull] should be called to complete the work. |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 _ReplacementOffsetBuilder(this.request) { | 267 _ReplacementOffsetBuilder(this.request) { |
| 306 request.replacementOffset = request.offset; | 268 request.replacementOffset = request.offset; |
| 307 request.replacementLength = 0; | 269 request.replacementLength = 0; |
| 308 } | 270 } |
| 309 | 271 |
| 310 visitSimpleIdentifier(SimpleIdentifier node) { | 272 visitSimpleIdentifier(SimpleIdentifier node) { |
| 311 request.replacementOffset = node.offset; | 273 request.replacementOffset = node.offset; |
| 312 request.replacementLength = node.length; | 274 request.replacementLength = node.length; |
| 313 } | 275 } |
| 314 } | 276 } |
| OLD | NEW |