File tree Expand file tree Collapse file tree 3 files changed +24
-9
lines changed
lib/src/services/completion/dart
test/services/completion/dart/location Expand file tree Collapse file tree 3 files changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -403,6 +403,8 @@ class DeclarationHelper {
403403 if (parent is ClassMember ) {
404404 assert (node is CommentReference );
405405 parent = parent.parent;
406+ } else if (parent is Directive ) {
407+ parent = parent.parent;
406408 } else if (parent is CompilationUnit ) {
407409 parent = containingMember;
408410 }
Original file line number Diff line number Diff line change @@ -61,6 +61,21 @@ suggestions
6161''' );
6262 }
6363
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+
6479 Future <void > test_extension () async {
6580 allowedIdentifiers = const {'MyExt' };
6681 await computeSuggestions ('''
@@ -160,23 +175,21 @@ suggestions
160175''' );
161176 }
162177
163- @FailingTest (issue: 'https://github.com/dart-lang/sdk/issues/59724' )
164178 Future <void > test_importPrefix () async {
165- allowedIdentifiers = const {'myPrefix ' };
179+ allowedIdentifiers = const {'async ' };
166180 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 ;
169183''' );
170184 assertResponse (r'''
171185replacement
172186 left: 3
173187suggestions
174- myPrefix
175- kind: importPrefix
188+ async
189+ kind: library
176190''' );
177191 }
178192
179- @FailingTest (issue: 'https://github.com/dart-lang/sdk/issues/59724' )
180193 Future <void > test_library () async {
181194 allowedIdentifiers = const {'MyClass1' };
182195 await computeSuggestions ('''
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import 'compilation_unit_test.dart' as compilation_unit;
2020import 'conditional_expression_test.dart' as conditional_expression;
2121import 'constructor_declaration_test.dart' as constructor_declaration;
2222import '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 ;
2424import 'directive_uri_test.dart' as directive_uri;
2525import 'enum_constant_test.dart' as enum_constant;
2626import 'enum_declaration_test.dart' as enum_declaration;
@@ -102,7 +102,7 @@ void main() {
102102 conditional_expression.main ();
103103 constructor_declaration.main ();
104104 constructor_invocation.main ();
105- dart_doc_test .main ();
105+ dart_doc .main ();
106106 directive_uri.main ();
107107 enum_constant.main ();
108108 enum_declaration.main ();
You can’t perform that action at this time.
0 commit comments