| 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 analysis_server.src.provisional.completion.completion_dart; | 5 library analysis_server.src.provisional.completion.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/provisional/completion/completion_core.dart'
; | 10 import 'package:analysis_server/src/provisional/completion/completion_core.dart'
; |
| 11 import 'package:analysis_server/src/provisional/completion/dart/completion_targe
t.dart'; | 11 import 'package:analysis_server/src/provisional/completion/dart/completion_targe
t.dart'; |
| 12 import 'package:analyzer/src/generated/ast.dart'; | 12 import 'package:analyzer/src/generated/ast.dart'; |
| 13 import 'package:analyzer/src/generated/element.dart'; | 13 import 'package:analyzer/src/generated/element.dart'; |
| 14 import 'package:analyzer/src/generated/source.dart'; |
| 14 | 15 |
| 15 export 'package:analysis_server/src/provisional/completion/completion_core.dart' | 16 export 'package:analysis_server/src/provisional/completion/completion_core.dart' |
| 16 show EMPTY_LIST; | 17 show EMPTY_LIST; |
| 17 | 18 |
| 18 const int DART_RELEVANCE_COMMON_USAGE = 1200; | 19 const int DART_RELEVANCE_COMMON_USAGE = 1200; |
| 19 const int DART_RELEVANCE_DEFAULT = 1000; | 20 const int DART_RELEVANCE_DEFAULT = 1000; |
| 20 const int DART_RELEVANCE_HIGH = 2000; | 21 const int DART_RELEVANCE_HIGH = 2000; |
| 21 const int DART_RELEVANCE_INHERITED_ACCESSOR = 1057; | 22 const int DART_RELEVANCE_INHERITED_ACCESSOR = 1057; |
| 22 const int DART_RELEVANCE_INHERITED_FIELD = 1058; | 23 const int DART_RELEVANCE_INHERITED_FIELD = 1058; |
| 23 const int DART_RELEVANCE_INHERITED_METHOD = 1057; | 24 const int DART_RELEVANCE_INHERITED_METHOD = 1057; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 * Return a [Future] that completes with the library element | 71 * Return a [Future] that completes with the library element |
| 71 * which contains the unit in which the completion is occurring. | 72 * which contains the unit in which the completion is occurring. |
| 72 * The [Future] may return `null` if the library cannot be determined | 73 * The [Future] may return `null` if the library cannot be determined |
| 73 * (e.g. unlinked part file). | 74 * (e.g. unlinked part file). |
| 74 * Any information obtained from [target] prior to calling this method | 75 * Any information obtained from [target] prior to calling this method |
| 75 * should be discarded as it may have changed. | 76 * should be discarded as it may have changed. |
| 76 */ | 77 */ |
| 77 Future<LibraryElement> get libraryElement; | 78 Future<LibraryElement> get libraryElement; |
| 78 | 79 |
| 79 /** | 80 /** |
| 81 * The source for the library containing the completion request. |
| 82 * This may be different from the source in which the completion is requested |
| 83 * if the completion is being requested in a part file. |
| 84 * This may be `null` if the library for a part file cannot be determined. |
| 85 */ |
| 86 Source get librarySource; |
| 87 |
| 88 /** |
| 80 * Answer the [DartType] for Object in dart:core | 89 * Answer the [DartType] for Object in dart:core |
| 81 */ | 90 */ |
| 82 DartType get objectType; | 91 DartType get objectType; |
| 83 | 92 |
| 84 /** | 93 /** |
| 85 * Return the completion target. This determines what part of the parse tree | 94 * Return the completion target. This determines what part of the parse tree |
| 86 * will receive the newly inserted text. | 95 * will receive the newly inserted text. |
| 96 * At a minimum, all declarations in the completion scope in [target.unit] |
| 97 * will be resolved if they can be resolved. |
| 87 */ | 98 */ |
| 88 CompletionTarget get target; | 99 CompletionTarget get target; |
| 89 | 100 |
| 90 /** | 101 /** |
| 91 * Return a [Future] that completes with a compilation unit in which | |
| 92 * all declarations in all scopes containing [target] have been resolved. | |
| 93 * The [Future] may return `null` if the unit cannot be resolved | |
| 94 * (e.g. unlinked part file). | |
| 95 * Any information obtained from [target] prior to calling this method | |
| 96 * should be discarded as it may have changed. | |
| 97 */ | |
| 98 Future<CompilationUnit> resolveDeclarationsInScope(); | |
| 99 | |
| 100 /** | |
| 101 * Return a [Future] that completes with a list of directives for the library | 102 * Return a [Future] that completes with a list of directives for the library |
| 102 * in which in which the completion is occurring. | 103 * in which in which the completion is occurring. |
| 103 * The [Future] may return `null` if the library unit cannot be determined | 104 * The [Future] may return `null` if the library unit cannot be determined |
| 104 * (e.g. unlinked part file). | 105 * (e.g. unlinked part file). |
| 105 * Any information obtained from [target] prior to calling this method | 106 * Any information obtained from [target] prior to calling this method |
| 106 * should be discarded as it may have changed. | 107 * should be discarded as it may have changed. |
| 107 */ | 108 */ |
| 108 Future<List<Directive>> resolveDirectives(); | 109 Future<List<Directive>> resolveDirectives(); |
| 109 | 110 |
| 110 /** | 111 /** |
| 111 * Return a [Future] that completes when the element associated with | 112 * Return a [Future] that completes when the element associated with |
| 112 * the given [expression] in the target compilation unit is available. | 113 * the given [expression] in the target compilation unit is available. |
| 113 * It may also complete if the expression cannot be resolved | 114 * It may also complete if the expression cannot be resolved |
| 114 * (e.g. unknown identifier, completion aborted, etc). | 115 * (e.g. unknown identifier, completion aborted, etc). |
| 115 * Any information obtained from [target] prior to calling this method | 116 * Any information obtained from [target] prior to calling this method |
| 116 * should be discarded as it may have changed. | 117 * should be discarded as it may have changed. |
| 117 */ | 118 */ |
| 118 Future resolveExpression(Expression expression); | 119 Future resolveExpression(Expression expression); |
| 119 } | 120 } |
| OLD | NEW |