Deemphasize reexported symbols [#1158] #1319
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@Hixie noticed, that when a library exports another library, but both
libraries are being docced together, the result is that each class that
is exported by both libraries is listed twice.
We should still list classes and other symbols in the libraries that
reexport them (since they still part of public API of those libs), but
we only gonna show "canonical" symbols in Search, and also we won't
create duplicate HTML pages for reexported symbols.
We define the reexported symbols in the following way:
i.e., in lib/src/../a.dart
So, Foo of lib C shouldn't have its own page and also shouldn't appear
in Search, because Foo was exported from B and B already has docs. All
links to Foo from HTML docs of C should point to the Foo of B.
To solve that, we build directed "export graph", where we track what
libs export what libs. Then, to find the "canonical" lib, we go up the
graph until we find first documented lib - that's going to be the
canonical one.
Then, we filter out non-canonical libs when building the search index,
and also use canonical lib in
.href
getters, this way ensuring wealways link to symbols in canonical libs and don't create HTML files for
symbols from non-canonical libs.
Testing: Unit tests, also built test docs (
testing/test_package_docs
),made sure we don't create files for non-canonical stuff (i.e. we create
fake/Cool
files, but notex/Cool
). Also, built Flutter docs, ensuredwe don't create
material/BoxDecoration
,rendering/BoxDecoration
andwidgets/BoxDecoration
, and only createpainting/BoxDecoration
files,and all the links point to
painting/BoxDecoration
.Fixes #1158