dartdoc
dartdoc copied to clipboard
[doc_imports] `[this]` won't resolve to the current element in new analyzer comment resolver
Background
Example of a [this]
reference:
- https://github.com/dart-lang/sdk/blob/c09cb46304325cc59890ef685d33f5e022da047e/sdk/lib/core/date_time.dart#L546
- toUtc method - DateTime class - dart:core library
Resolution today
Dartdoc adds this as a reference child to look through. When it looks for a reference for the current ModelElement, it will find itself and create a link to that element.
Resolution tomorrow
AFAIK the comment reference resolver in the analyzer doesn’t handle a reference named this
.
We need to make sure that we add this
into the ModelNode
data that we are building up in Dartdoc, or alter the analyzer reference resolver in some way (not sure about this one).
But make sure we handle this, otherwise there will be a regression once we move to solely use what the analyzer provides.
Related linter issue: https://github.com/dart-lang/linter/issues/2079
We think this is acceptable. I can remove support for [this]
in dartdoc, so that the change is incremental, and we can analyze the ongoing gap between the current universal reference support, and analyzer resolution.
That sounds good. There's other ways to reference the current element anyways.