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 | 14 |
14 export 'package:analysis_server/src/provisional/completion/completion_core.dart' | 15 export 'package:analysis_server/src/provisional/completion/completion_core.dart' |
15 show EMPTY_LIST; | 16 show EMPTY_LIST; |
16 | 17 |
17 const int DART_RELEVANCE_COMMON_USAGE = 1200; | 18 const int DART_RELEVANCE_COMMON_USAGE = 1200; |
18 const int DART_RELEVANCE_DEFAULT = 1000; | 19 const int DART_RELEVANCE_DEFAULT = 1000; |
19 const int DART_RELEVANCE_HIGH = 2000; | 20 const int DART_RELEVANCE_HIGH = 2000; |
20 const int DART_RELEVANCE_INHERITED_ACCESSOR = 1057; | 21 const int DART_RELEVANCE_INHERITED_ACCESSOR = 1057; |
21 const int DART_RELEVANCE_INHERITED_FIELD = 1058; | 22 const int DART_RELEVANCE_INHERITED_FIELD = 1058; |
22 const int DART_RELEVANCE_INHERITED_METHOD = 1057; | 23 const int DART_RELEVANCE_INHERITED_METHOD = 1057; |
(...skipping 30 matching lines...) Expand all Loading... |
53 DartCompletionRequest request); | 54 DartCompletionRequest request); |
54 } | 55 } |
55 | 56 |
56 /** | 57 /** |
57 * The information about a requested list of completions within a Dart file. | 58 * The information about a requested list of completions within a Dart file. |
58 * | 59 * |
59 * Clients may not extend, implement or mix-in this class. | 60 * Clients may not extend, implement or mix-in this class. |
60 */ | 61 */ |
61 abstract class DartCompletionRequest extends CompletionRequest { | 62 abstract class DartCompletionRequest extends CompletionRequest { |
62 /** | 63 /** |
| 64 * Return a [Future] that completes with the library element |
| 65 * which contains the unit in which the completion is occurring. |
| 66 * The [Future] may return `null` if the library cannot be determined |
| 67 * (e.g. unlinked part file). |
| 68 * Any information obtained from [target] prior to calling this method |
| 69 * should be discarded as it may have changed. |
| 70 */ |
| 71 Future<LibraryElement> get libraryElement; |
| 72 |
| 73 /** |
63 * Return the completion target. This determines what part of the parse tree | 74 * Return the completion target. This determines what part of the parse tree |
64 * will receive the newly inserted text. | 75 * will receive the newly inserted text. |
65 */ | 76 */ |
66 CompletionTarget get target; | 77 CompletionTarget get target; |
67 | 78 |
68 /** | 79 /** |
69 * Return a [Future] that completes with a compilation unit in which | 80 * Return a [Future] that completes with a compilation unit in which |
70 * all declarations in all scopes containing [target] have been resolved. | 81 * all declarations in all scopes containing [target] have been resolved. |
71 * The [Future] may return `null` if the unit cannot be resolved | 82 * The [Future] may return `null` if the unit cannot be resolved |
72 * (e.g. unlinked part file). | 83 * (e.g. unlinked part file). |
73 * Any information obtained from [target] prior to calling this method | 84 * Any information obtained from [target] prior to calling this method |
74 * should be discarded as it may have changed. | 85 * should be discarded as it may have changed. |
75 */ | 86 */ |
76 Future<CompilationUnit> resolveDeclarationsInScope(); | 87 Future<CompilationUnit> resolveDeclarationsInScope(); |
77 | 88 |
78 /** | 89 /** |
79 * Return a [Future] that completes when the element associated with | 90 * Return a [Future] that completes when the element associated with |
80 * the given [identifier] is available or if the identifier cannot be resolved | 91 * the given [identifier] is available or if the identifier cannot be resolved |
81 * (e.g. unknown identifier, completion aborted, etc). | 92 * (e.g. unknown identifier, completion aborted, etc). |
82 * Any information obtained from [target] prior to calling this method | 93 * Any information obtained from [target] prior to calling this method |
83 * should be discarded as it may have changed. | 94 * should be discarded as it may have changed. |
84 */ | 95 */ |
85 Future resolveIdentifier(SimpleIdentifier identifier); | 96 Future resolveIdentifier(SimpleIdentifier identifier); |
86 } | 97 } |
OLD | NEW |