Skip to content

Commit 9dd284e

Browse files
FMorschelCommit Queue
authored andcommitted
[DAS] Fixes comment references completion outside braces
Fixes: Dart-Code/Dart-Code#5507 Change-Id: Icd83264a3d31118c4ee837e2dd2303fd1e10b42a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427460 Auto-Submit: Felipe Morschel <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent cfb4fed commit 9dd284e

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,9 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
678678

679679
@override
680680
void visitComment(Comment node) {
681-
node.visitChildren(this);
681+
// This should never call its children. They should, instead, be called
682+
// directly by the containing node. Making sure all annotated nodes have
683+
// the comments on the children call is the right way to handle this case.
682684
}
683685

684686
@override

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,17 @@ suggestions
306306
''');
307307
}
308308

309+
Future<void> test_notInSquareBraces() async {
310+
allowedIdentifiers = const {'MyClass1'};
311+
await computeSuggestions('''
312+
/// This doc should not suggest the commented class name [] outside the braces ^
313+
class MyClass1 {}
314+
''');
315+
assertResponse(r'''
316+
suggestions
317+
''');
318+
}
319+
309320
Future<void> test_parameter() async {
310321
allowedIdentifiers = const {'param1'};
311322
await computeSuggestions('''

0 commit comments

Comments
 (0)