-
Notifications
You must be signed in to change notification settings - Fork 602
Format see also in Python & Swift #4622
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for "See Also" documentation sections in Swift and Python code generators. The implementation follows existing documentation patterns in both languages to properly render @see tags from Slice documentation comments.
Key changes:
- Added
formatSeeAlsomethod implementations for Swift and Python code generators to format see-also links - Integrated see-also sections into Swift doc comments using Swift's
- See Alsoformat - Integrated see-also sections into Python docstrings using reStructuredText format with proper section underlining
- Updated Python link formatter to handle scope separators (
::and#) when formatting unresolved references
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| cpp/src/slice2swift/Main.cpp | Added formatSeeAlso method to SwiftDocCommentFormatter |
| cpp/src/slice2swift/SwiftUtil.cpp | Integrated see-also section rendering in Swift doc comments and fixed "Remark" format |
| cpp/src/slice2py/PythonUtil.h | Added writeSeeAlso method declaration |
| cpp/src/slice2py/PythonUtil.cpp | Implemented see-also section rendering in Python docstrings and improved link formatter for unresolved references |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
InsertCreativityHere
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
cpp/src/slice2py/PythonUtil.cpp
Outdated
| string formatSeeAlso(const string& rawLink, const ContainedPtr& source, const SyntaxTreeBasePtr& target) final | ||
| { | ||
| return Slice::Python::pyLinkFormatter(rawLink, source, target); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't necessary, formatSeeAlso is default-implemented to call formatLink:
ice/cpp/src/Slice/DocCommentParser.cpp
Lines 68 to 73 in daaa6e3
| string | |
| DocCommentFormatter::formatSeeAlso(const string& rawLink, const ContainedPtr& source, const SyntaxTreeBasePtr& target) | |
| { | |
| // Many languages don't support 'see-also' tags, so by default we map them to regular doc-links. | |
| return formatLink(rawLink, source, target); | |
| } |
and indeed, this has the same implementation as
formatLink.
cpp/src/slice2swift/Main.cpp
Outdated
| string formatSeeAlso(const string& rawLink, const ContainedPtr& source, const SyntaxTreeBasePtr& target) final | ||
| { | ||
| return Slice::Swift::swiftLinkFormatter(rawLink, source, target); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also not necessary, will already re-use formatLink automatically.
Fix #4570