File tree 3 files changed +24
-9
lines changed
lib/src/services/completion/dart
test/services/completion/dart/location
3 files changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -403,6 +403,8 @@ class DeclarationHelper {
403
403
if (parent is ClassMember ) {
404
404
assert (node is CommentReference );
405
405
parent = parent.parent;
406
+ } else if (parent is Directive ) {
407
+ parent = parent.parent;
406
408
} else if (parent is CompilationUnit ) {
407
409
parent = containingMember;
408
410
}
Original file line number Diff line number Diff line change @@ -61,6 +61,21 @@ suggestions
61
61
''' );
62
62
}
63
63
64
+ Future <void > test_enum () async {
65
+ allowedIdentifiers = const {'MyEnum' };
66
+ await computeSuggestions ('''
67
+ /// This doc should suggest the commented enum name [MyE^].
68
+ enum MyEnum { value1 }
69
+ ''' );
70
+ assertResponse (r'''
71
+ replacement
72
+ left: 3
73
+ suggestions
74
+ MyEnum
75
+ kind: enum
76
+ ''' );
77
+ }
78
+
64
79
Future <void > test_extension () async {
65
80
allowedIdentifiers = const {'MyExt' };
66
81
await computeSuggestions ('''
@@ -160,23 +175,21 @@ suggestions
160
175
''' );
161
176
}
162
177
163
- @FailingTest (issue: 'https://github.com/dart-lang/sdk/issues/59724' )
164
178
Future <void > test_importPrefix () async {
165
- allowedIdentifiers = const {'myPrefix ' };
179
+ allowedIdentifiers = const {'async ' };
166
180
await computeSuggestions ('''
167
- /// This doc should suggest the commented import prefix name [myP ^].
168
- import 'dart:async' as myPrefix ;
181
+ /// This doc should suggest the commented import prefix name [asy ^].
182
+ import 'dart:async' as async ;
169
183
''' );
170
184
assertResponse (r'''
171
185
replacement
172
186
left: 3
173
187
suggestions
174
- myPrefix
175
- kind: importPrefix
188
+ async
189
+ kind: library
176
190
''' );
177
191
}
178
192
179
- @FailingTest (issue: 'https://github.com/dart-lang/sdk/issues/59724' )
180
193
Future <void > test_library () async {
181
194
allowedIdentifiers = const {'MyClass1' };
182
195
await computeSuggestions ('''
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import 'compilation_unit_test.dart' as compilation_unit;
20
20
import 'conditional_expression_test.dart' as conditional_expression;
21
21
import 'constructor_declaration_test.dart' as constructor_declaration;
22
22
import 'constructor_invocation_test.dart' as constructor_invocation;
23
- import 'dart_doc_test.dart' as dart_doc_test ;
23
+ import 'dart_doc_test.dart' as dart_doc ;
24
24
import 'directive_uri_test.dart' as directive_uri;
25
25
import 'enum_constant_test.dart' as enum_constant;
26
26
import 'enum_declaration_test.dart' as enum_declaration;
@@ -102,7 +102,7 @@ void main() {
102
102
conditional_expression.main ();
103
103
constructor_declaration.main ();
104
104
constructor_invocation.main ();
105
- dart_doc_test .main ();
105
+ dart_doc .main ();
106
106
directive_uri.main ();
107
107
enum_constant.main ();
108
108
enum_declaration.main ();
You can’t perform that action at this time.
0 commit comments