Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to disambiguate symbol links using type signature information #1095

Merged

Conversation

d-ronnqvist
Copy link
Contributor

Bug/issue #, if applicable: rdar://136207820

Summary

This adds user facing documentation about disambiguating symbol links using type signature information, added in #643 and #1087

At first I tried to insert a section about type signature into the existing documentation structure but I found that the current order made the documentation hard to follow. Specifically, these two changes made the flow of the documentation somewhat confusing:

  • Examples about unambiguous symbol links were both before and after the examples about ambiguous symbol links. With even more examples about ambiguous links, this made it hard to know where to insert the new examples.
  • Disambiguation using hashes was explained before disambiguation using symbol types. This made it hard to know where to insert the explanation about type signature disambiguation.

So, before adding new documentation I addressed some of the issues with the flow of the existing documentation:

  • Adding more documentation, with examples, about how relative symbol links work.
  • Moving all examples of unambiguous symbol links before any examples of ambiguous symbol links and creating a dedicated subsection about link disambiguation.
  • Move the example about symbol kind disambiguation before the example about hash disambiguation so that there's a clear flow from simpler and more readable disambiguation to the unreadable hash disambiguation.
  • Add a handful of missing symbol type to the list of supported symbol type disambiguation values.

With those changes done, it felt more natural to:

  • First update the Sloth/update(_:) to give a basic description of type signature disambiguation
  • Then add a more advanced example with mixed parameter type and return values disambiguation.

Dependencies

None.

Testing

Read the new documentation.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • [ ] Added tests This only changes documentation.
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

@d-ronnqvist d-ronnqvist added the documentation Improvements or additions to documentation label Nov 13, 2024
Copy link
Member

@heckj heckj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great David. Kind of jealous of the text-graphics skill in some of those examples. And hugely looking forward to this capability in 6.1+, the symbols are hugely easier to understand while writing!

Copy link
Contributor

@mayaepps mayaepps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! 🎉

Symbol paths are case-sensitive, meaning that symbols with the same name in
different text casing don't need disambiguation.
Symbol type suffixes can include a source language identifier prefix---for example, `-swift.enum` instead of `-enum`.
However, the language identifier doesn't disambiguate the link.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it doesn't disambiguate the link, why would someone use this suffix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the first few releases of DocC (before Xcode 14.3) DocC required the language identifier prefix for unrelated and uninteresting implementation detail reasons, even though the that information wasn't useful for disambiguation purposes. Links created during those releases continue to work but can be shortened.

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist merged commit aeb55a3 into swiftlang:main Dec 10, 2024
2 checks passed
@d-ronnqvist d-ronnqvist deleted the type-disambiguation-documentation branch December 10, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants