File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 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> {
677677 }
678678 }
679679
680+ @override
681+ void visitComment (Comment node) {
682+ node.visitChildren (this );
683+ }
684+
680685 @override
681686 void visitCommentReference (CommentReference node) {
682687 collector.completionLocation = 'CommentReference_identifier' ;
@@ -1128,6 +1133,8 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
11281133 if (offset == node.offset) {
11291134 _forCompilationUnitMemberBefore (node);
11301135 return ;
1136+ } else if (node.documentationComment.coversOffset (offset)) {
1137+ return node.documentationComment? .accept (this );
11311138 } else if (offset < node.extensionKeyword.offset) {
11321139 // There are no modifiers for extensions.
11331140 return ;
@@ -1519,6 +1526,8 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
15191526 } else if (offset >= node.equals.end && offset <= node.semicolon.offset) {
15201527 collector.completionLocation = 'GenericTypeAlias_type' ;
15211528 _forTypeAnnotation (node);
1529+ } else if (node.documentationComment.coversOffset (offset)) {
1530+ node.documentationComment? .accept (this );
15221531 }
15231532 }
15241533
Original file line number Diff line number Diff line change @@ -61,7 +61,6 @@ suggestions
6161''' );
6262 }
6363
64- @FailingTest (issue: 'https://github.com/dart-lang/sdk/issues/59724' )
6564 Future <void > test_extension () async {
6665 allowedIdentifiers = const {'MyExt' };
6766 await computeSuggestions ('''
@@ -73,7 +72,7 @@ replacement
7372 left: 3
7473suggestions
7574 MyExt
76- kind: extension
75+ kind: extensionInvocation
7776''' );
7877 }
7978
@@ -304,7 +303,6 @@ suggestions
304303''' );
305304 }
306305
307- @FailingTest (issue: 'https://github.com/dart-lang/sdk/issues/59724' )
308306 Future <void > test_typedef () async {
309307 allowedIdentifiers = const {'MyTypedef' };
310308 await computeSuggestions ('''
@@ -316,7 +314,7 @@ replacement
316314 left: 3
317315suggestions
318316 MyTypedef
319- kind: typedef
317+ kind: typeAlias
320318''' );
321319 }
322320
Original file line number Diff line number Diff line change @@ -512,6 +512,13 @@ class CompletionTarget {
512512 containingNode.parent.ifTypeOrNull () ??
513513 // SimpleString -> Configuration -> Directive
514514 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+ }
515522 }
516523 // Replacement range for a URI.
517524 if (directive != null && uri is SimpleStringLiteral ) {
You can’t perform that action at this time.
0 commit comments