Skip to content

Commit c083f5a

Browse files
FMorschelCommit Queue
authored and
Commit Queue
committed
[DAS] Fixes import and library doc comments. Adds missing enum test
[email protected] Bug: #59724 Change-Id: I580b39acc96697990b12527aea699cdf09d788e3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411360 Auto-Submit: Felipe Morschel <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]> Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent 977b6ef commit c083f5a

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

pkg/analysis_server/lib/src/services/completion/dart/declaration_helper.dart

+2
Original file line numberDiff line numberDiff 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
}

pkg/analysis_server/test/services/completion/dart/location/dart_doc_test.dart

+20-7
Original file line numberDiff line numberDiff 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'''
171185
replacement
172186
left: 3
173187
suggestions
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('''

pkg/analysis_server/test/services/completion/dart/location/test_all.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import 'compilation_unit_test.dart' as compilation_unit;
2020
import 'conditional_expression_test.dart' as conditional_expression;
2121
import 'constructor_declaration_test.dart' as constructor_declaration;
2222
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;
2424
import 'directive_uri_test.dart' as directive_uri;
2525
import 'enum_constant_test.dart' as enum_constant;
2626
import '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();

0 commit comments

Comments
 (0)