Skip to content

Commit 154b473

Browse files
DanTupCommit Queue
authored and
Commit Queue
committed
[analysis_server] Fix missing dartdoc references in Library comments
Fixes #59946 Change-Id: I3b8558f72b6cc932f2c87ee4f2e993c5584907a7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405361 Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent 0037a5c commit 154b473

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

pkg/analysis_server/test/analysis/get_navigation_test.dart

+34
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,40 @@ final foo = {"key": ?Foo()};
211211
expect(target.length, 3);
212212
}
213213

214+
Future<void> test_documentation() async {
215+
addTestFile('''
216+
/// [math]
217+
import 'dart:math' as math;
218+
''');
219+
await waitForTasksFinished();
220+
await _getNavigation(search: 'math]');
221+
expect(regions, hasLength(1));
222+
assertHasRegionString('math');
223+
expect(testTargets, hasLength(1));
224+
var target = targets[regions.first.targets.first];
225+
expect(target.kind, ElementKind.PREFIX);
226+
expect(target.offset, findOffset('math;'));
227+
expect(target.length, 4);
228+
}
229+
230+
Future<void> test_documentation_library() async {
231+
addTestFile('''
232+
/// [math]
233+
library;
234+
235+
import 'dart:math' as math;
236+
''');
237+
await waitForTasksFinished();
238+
await _getNavigation(search: 'math]');
239+
expect(regions, hasLength(1));
240+
assertHasRegionString('math');
241+
expect(testTargets, hasLength(1));
242+
var target = targets[regions.first.targets.first];
243+
expect(target.kind, ElementKind.PREFIX);
244+
expect(target.offset, findOffset('math;'));
245+
expect(target.length, 4);
246+
}
247+
214248
Future<void> test_field_underscore() async {
215249
addTestFile('''
216250
class C {

pkg/analyzer_plugin/lib/src/utilities/navigation/navigation_dart.dart

+1
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ class _DartNavigationComputerVisitor extends RecursiveAstVisitor<void> {
438438
@override
439439
void visitLibraryDirective(LibraryDirective node) {
440440
computer._addRegionForElement(node.name2, node.element2);
441+
super.visitLibraryDirective(node);
441442
}
442443

443444
@override

0 commit comments

Comments
 (0)