Commit 832f1eb
committed
Add the abbreviated declaration fragments to LinkDestinationSummary
LinkDestinationSummary contains a summary of an element that you can link to from outside the documentation bundle. [1]
This information is meant to be used by a server to provide information to an out-of-process resolver to resolve links to external entities, so that the partner implementation of `LinkDestinationSummary` is `OutOfProcessReferenceResolver.ResolvedInformation` [2].
As part of `LinkDestinationSummary`, we store the full declaration fragments of the symbol [3][4].
However, currently `OutOfProcessReferenceResolver` is using these full declaration fragments to populate `TopicRenderReference.fragmentsVariants` [5], which expects the abbreviated declaration fragments [6].
These abbreviated declaration fragments are meant to be used in the Topics section and the navigation index in order to reduce verbosity and improve readability by removing any declaration fragments non-essential to the core of the symbol declaration.
These abbreviated declaration fragments are not captured as part of `LinkDestinationSummary` or `OutOfProcessReferenceResolver.ResolvedInformation`. To start capturing this information, this commit modifies `LinkDestinationSummary` to add a new optional field `subHeadingDeclarationFragments` which stores the abbreviated declaration fragments from `renderNode.metadata.fragmentsVariants` (abbreviated declaration fragments are derived from the `subHeading` of the symbol [7], further processed during the render node transformation phase, and finally stored as `renderNode.metadata.fragmentsVariants` [8]).
This will enable us to use them in `OutOfProcessReferenceResolver.ResolvedInformation` to initialise `TopicRenderReference.fragmentsVariants` with the expected value.
The final goal is for a symbol's representation in the Topics section and the navigation index to look the same regardless of whether the symbol is a local or external one.
Fixes rdar://156488052.
Alternatives considered:
------------------------
Considered modifying `LinkDestinationSummary.declarationFragments` instead of adding a new optional field, however the full declaration fragments are used to determine the full name [9] of the symbol for diagnostic reporting [10].
By introducing a new field we also ensure this is a non-breaking change.
[1]: https://github.com/swiftlang/swift-docc/blob/65aaf926ec079ddbd40f29540d4180a70af99e5e/Sources/SwiftDocC/LinkTargets/LinkDestinationSummary.swift#L66
[2]: https://github.com/swiftlang/swift-docc/blob/65aaf926ec079ddbd40f29540d4180a70af99e5e/Sources/SwiftDocC/Infrastructure/External%20Data/OutOfProcessReferenceResolver.swift#L558-L562
[3]: https://github.com/swiftlang/swift-docc/blob/1b4a1850dd2785a8ebabded139ae0af3551bb029/Sources/SwiftDocC/LinkTargets/LinkDestinationSummary.swift#L140-L141
[4]: https://github.com/swiftlang/swift-docc/blob/1b4a1850dd2785a8ebabded139ae0af3551bb029/Sources/SwiftDocC/LinkTargets/LinkDestinationSummary.swift#L445
[5]: https://github.com/swiftlang/swift-docc/blob/1b4a1850dd2785a8ebabded139ae0af3551bb029/Sources/SwiftDocC/Infrastructure/External%20Data/OutOfProcessReferenceResolver.swift#L169
[6]: https://github.com/swiftlang/swift-docc/blob/1b4a1850dd2785a8ebabded139ae0af3551bb029/Sources/SwiftDocC/Model/Rendering/References/TopicRenderReference.swift#L50-L53
[7]: https://github.com/swiftlang/swift-docc-symbolkit/blob/ebe89c7da4cf03ded04cd708f3399087c6f2dad7/Sources/SymbolKit/SymbolGraph/Symbol/Names.swift#L28-L31
[8]: https://github.com/swiftlang/swift-docc/blob/1b4a1850dd2785a8ebabded139ae0af3551bb029/Sources/SwiftDocC/Model/Rendering/RenderNodeTranslator.swift#L1304
[9]: https://github.com/swiftlang/swift-docc/blob/1b4a1850dd2785a8ebabded139ae0af3551bb029/Sources/SwiftDocC/Infrastructure/Link%20Resolution/ExternalPathHierarchyResolver.swift#L61-L63
[10]: https://github.com/swiftlang/swift-docc/blob/1b4a1850dd2785a8ebabded139ae0af3551bb029/Sources/SwiftDocC/Infrastructure/Link%20Resolution/PathHierarchy%2BError.swift#L115-L1171 parent 1b4a185 commit 832f1eb
File tree
2 files changed
+63
-3
lines changed- Sources/SwiftDocC/LinkTargets
- Tests/SwiftDocCTests/LinkTargets
2 files changed
+63
-3
lines changedLines changed: 38 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
143 | 148 | | |
144 | 149 | | |
145 | 150 | | |
| |||
197 | 202 | | |
198 | 203 | | |
199 | 204 | | |
200 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
201 | 212 | | |
202 | 213 | | |
203 | 214 | | |
| |||
215 | 226 | | |
216 | 227 | | |
217 | 228 | | |
| 229 | + | |
218 | 230 | | |
219 | 231 | | |
220 | 232 | | |
| |||
226 | 238 | | |
227 | 239 | | |
228 | 240 | | |
| 241 | + | |
229 | 242 | | |
230 | 243 | | |
231 | 244 | | |
| |||
237 | 250 | | |
238 | 251 | | |
239 | 252 | | |
| 253 | + | |
240 | 254 | | |
241 | 255 | | |
242 | 256 | | |
| |||
258 | 272 | | |
259 | 273 | | |
260 | 274 | | |
| 275 | + | |
261 | 276 | | |
262 | 277 | | |
263 | 278 | | |
| |||
273 | 288 | | |
274 | 289 | | |
275 | 290 | | |
| 291 | + | |
276 | 292 | | |
277 | 293 | | |
278 | 294 | | |
| |||
289 | 305 | | |
290 | 306 | | |
291 | 307 | | |
| 308 | + | |
292 | 309 | | |
293 | 310 | | |
294 | 311 | | |
| |||
444 | 461 | | |
445 | 462 | | |
446 | 463 | | |
447 | | - | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
448 | 469 | | |
449 | 470 | | |
450 | 471 | | |
| |||
460 | 481 | | |
461 | 482 | | |
462 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
463 | 489 | | |
464 | 490 | | |
465 | 491 | | |
| |||
470 | 496 | | |
471 | 497 | | |
472 | 498 | | |
| 499 | + | |
473 | 500 | | |
474 | 501 | | |
475 | 502 | | |
| |||
490 | 517 | | |
491 | 518 | | |
492 | 519 | | |
| 520 | + | |
493 | 521 | | |
494 | 522 | | |
495 | 523 | | |
| |||
574 | 602 | | |
575 | 603 | | |
576 | 604 | | |
| 605 | + | |
577 | 606 | | |
578 | 607 | | |
579 | 608 | | |
| |||
589 | 618 | | |
590 | 619 | | |
591 | 620 | | |
| 621 | + | |
592 | 622 | | |
593 | 623 | | |
594 | 624 | | |
| |||
626 | 656 | | |
627 | 657 | | |
628 | 658 | | |
| 659 | + | |
629 | 660 | | |
630 | 661 | | |
631 | 662 | | |
| |||
641 | 672 | | |
642 | 673 | | |
643 | 674 | | |
| 675 | + | |
644 | 676 | | |
645 | 677 | | |
646 | 678 | | |
| |||
653 | 685 | | |
654 | 686 | | |
655 | 687 | | |
| 688 | + | |
656 | 689 | | |
657 | 690 | | |
658 | 691 | | |
| |||
692 | 725 | | |
693 | 726 | | |
694 | 727 | | |
| 728 | + | |
| 729 | + | |
695 | 730 | | |
696 | 731 | | |
697 | 732 | | |
| |||
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
192 | 197 | | |
193 | 198 | | |
194 | 199 | | |
| |||
230 | 235 | | |
231 | 236 | | |
232 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
233 | 245 | | |
234 | 246 | | |
235 | 247 | | |
| |||
265 | 277 | | |
266 | 278 | | |
267 | 279 | | |
| 280 | + | |
268 | 281 | | |
269 | 282 | | |
270 | 283 | | |
| |||
303 | 316 | | |
304 | 317 | | |
305 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
306 | 331 | | |
307 | 332 | | |
308 | 333 | | |
| |||
0 commit comments