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.
Summary
parameter.
to determine if a symbolgraph is the primary graph for that module.
Snippet extension graphs being considered primary is the source of non-deterministic results in previewing documentation that include snippets (swiftlang/swift-docc#1084). For the logic within swift-dock's SymbolGraphLoader, they should be considered extension graphs. Since the snippet symbol graph extractor doesn't generate an @ in the file name of the graph, the logic is amended to look at the isVirtual metadata for the module, which is set to true for snippets.
I considered using the name generated by the snippet extractor, or doing some heuristic on the name the generator metadata, but after staring at the data for a while, the SymbolGraph.module.isVirtual seemed a more exact and lasting means of determining if a given symbol graph is "the main one" or not.
(reset of #89, previously reverted, when smoke tests didn't pass)
Dependencies
Depends on swiftlang/swift-docc#1160 for the CI/smoke tests to pass (in particular, this PR was merged earlier, and reverted, due to tests in swift-docc repeatedly failing with these updates. The PR in swift-docc adds structure to a test fixture so that better represents snippets as extending another symbolgraph, which resolves these test issues.
Testing
Added unit tests to verify loading functionality
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded