File tree 3 files changed +18
-4
lines changed
lib/src/services/completion/dart
test/services/completion/dart/location
analyzer_plugin/lib/src/utilities/completion 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -677,6 +677,11 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
677
677
}
678
678
}
679
679
680
+ @override
681
+ void visitComment (Comment node) {
682
+ node.visitChildren (this );
683
+ }
684
+
680
685
@override
681
686
void visitCommentReference (CommentReference node) {
682
687
collector.completionLocation = 'CommentReference_identifier' ;
@@ -1128,6 +1133,8 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
1128
1133
if (offset == node.offset) {
1129
1134
_forCompilationUnitMemberBefore (node);
1130
1135
return ;
1136
+ } else if (node.documentationComment.coversOffset (offset)) {
1137
+ return node.documentationComment? .accept (this );
1131
1138
} else if (offset < node.extensionKeyword.offset) {
1132
1139
// There are no modifiers for extensions.
1133
1140
return ;
@@ -1519,6 +1526,8 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
1519
1526
} else if (offset >= node.equals.end && offset <= node.semicolon.offset) {
1520
1527
collector.completionLocation = 'GenericTypeAlias_type' ;
1521
1528
_forTypeAnnotation (node);
1529
+ } else if (node.documentationComment.coversOffset (offset)) {
1530
+ node.documentationComment? .accept (this );
1522
1531
}
1523
1532
}
1524
1533
Original file line number Diff line number Diff line change @@ -61,7 +61,6 @@ suggestions
61
61
''' );
62
62
}
63
63
64
- @FailingTest (issue: 'https://github.com/dart-lang/sdk/issues/59724' )
65
64
Future <void > test_extension () async {
66
65
allowedIdentifiers = const {'MyExt' };
67
66
await computeSuggestions ('''
@@ -73,7 +72,7 @@ replacement
73
72
left: 3
74
73
suggestions
75
74
MyExt
76
- kind: extension
75
+ kind: extensionInvocation
77
76
''' );
78
77
}
79
78
@@ -304,7 +303,6 @@ suggestions
304
303
''' );
305
304
}
306
305
307
- @FailingTest (issue: 'https://github.com/dart-lang/sdk/issues/59724' )
308
306
Future <void > test_typedef () async {
309
307
allowedIdentifiers = const {'MyTypedef' };
310
308
await computeSuggestions ('''
@@ -316,7 +314,7 @@ replacement
316
314
left: 3
317
315
suggestions
318
316
MyTypedef
319
- kind: typedef
317
+ kind: typeAlias
320
318
''' );
321
319
}
322
320
Original file line number Diff line number Diff line change @@ -512,6 +512,13 @@ class CompletionTarget {
512
512
containingNode.parent.ifTypeOrNull () ??
513
513
// SimpleString -> Configuration -> Directive
514
514
containingNode.parent? .parent.ifTypeOrNull ();
515
+ } else if (containingNode is Comment ) {
516
+ for (var reference in containingNode.references) {
517
+ if (reference.offset <= requestOffset &&
518
+ reference.end >= requestOffset) {
519
+ return SourceRange (reference.offset, reference.length);
520
+ }
521
+ }
515
522
}
516
523
// Replacement range for a URI.
517
524
if (directive != null && uri is SimpleStringLiteral ) {
You can’t perform that action at this time.
0 commit comments