Skip to content

Conversation

@dylansturg
Copy link
Contributor

@dylansturg dylansturg commented Dec 15, 2025

The extended module's name is typically extracted from the filename of the symbolgraph. This approach is problematic for modules with long names, because the filename "ModuleA@ModuleB" can exceed the limits for filepath segments on common file systems, e.g. there's a limit of 255 on macOS. This root problem has an opt-in workaround now, with the changes in #83782 to support a new option "symbol-graph-shorten-output-names". But that approach alone leaves swift-docc-symbolkit in a tough spot to handle the alternative naming convention.

It would be nice to also support the symbolgraph files of modules with long names in swift-docc-symbolkit. That library extracts the name of the symbolgraph's module to use for merging declarations in the same module. In some modes, extensions are merged with declarations from the extended module instead of the declaring module. When generating symbolgraphs with -symbol-graph-shorten-output-names, swift-docc-symbolkit cannot determine the extended module name. There appears to be 2 options to solve this: (A) propagate the rename map file throughout symbolkit and its callers to lookup the extended module's name as needed, or (B) store the extended module in the symbolgraph JSON representation.

This change enables option B. This option reduces the complexity of changes in swift-docc-symbolkit, while allowing simple backwards compatibility by defaulting to the current "Module@Extended" naming scheme.

I will also share draft PRs for corresponding changes to swift-docc-symbolkit and swift-docc.

Dependencies

…sentation.

The extended module's name is typically extracted from the filename of the symbolgraph. This approach is problematic for modules with long names, because the filename "ModuleA@ModuleB" can exceed the limits for filepath segments on common file systems, e.g. there's a limit of 255 on macOS. This root problem has an opt-in workaround now, with the changes in swiftlang#83782 to support a new option "symbol-graph-shorten-output-names". But that approach alone leaves swift-docc-symbolkit in a tough spot to handle the alternative naming convention.

It would be nice to also support the symbolgraph files of modules with long names in swift-docc-symbolkit. That library extracts the name of the symbolgraph's module to use for merging declarations in the same module. In some modes, extensions are merged with declarations from the extended module instead of the declaring module. When generating symbolgraphs with `-symbol-graph-shorten-output-names`, swift-docc-symbolkit cannot determine the extended module name. There appears to be 2 options to solve this: (A) propagate the rename map file throughout symbolkit and its callers to lookup the extended module's name as needed, or (B) store the extended module in the symbolgraph JSON representation.

This change enables option B. This option reduces the complexity of changes in swift-docc-symbolkit, while allowing simple backwards compatibility by defaulting to the current "Module@Extended" naming scheme.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant