Skip to content

Highlight unique components of overloaded declarations #841

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

mportiz08
Copy link
Contributor

Bug/issue #, if applicable: 117503463

Summary

Adds support for highlighting the unique components of overloaded declarations through a new, recursive declaration token component. These highlighted tokens will only be visually rendered when a group of overloaded symbols have been expanded by the user.

Example

Here, the highlights emphasize that this function is overloaded by the type of its only parameter.

Screenshot 2024-05-28 at 5 03 28 PM

Dependencies

swift-docc: Highlight declaration differences in overloaded symbol groups #928

Testing

Steps:

  1. Checkout this branch and run npm run build
  2. Checkout the branch of swift-docc from this PR and run swift build
  3. Run DOCC_HTML_DIR=/path/to/swift-docc-render/dist swift run docc preview --enable-experimental-overloaded-symbol-presentation Tests/SwiftDocCTests/Test\ Bundles/OverloadedSymbols.docc
  4. Verify that the unique parts of overloaded functions like the one in the above example are visually highlighted, only after disclosing the full list of the overloaded variants

Checklist

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

  • Added tests
  • Ran npm test, and it succeeded
  • Updated documentation if necessary

\cc @QuietMisdreavus

@mportiz08
Copy link
Contributor Author

@swift-ci test

@mportiz08
Copy link
Contributor Author

Marking this as a draft, because it sounds like the swift-docc design for the Render JSON may change

@mportiz08 mportiz08 marked this pull request as draft May 30, 2024 02:09
</template>

<script>
export default { name: 'Highlighted' };
Copy link
Member

Choose a reason for hiding this comment

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

Maybe in the future we can reuse this component for other highlighting context like codeListing to unify all these logics in some way. I know it doesn't look easy

Copy link
Member

@marinaaisa marinaaisa left a comment

Choose a reason for hiding this comment

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

Tested and it works great!

@mportiz08 mportiz08 closed this Jun 3, 2024
@mportiz08
Copy link
Contributor Author

mportiz08 commented Jun 3, 2024

Re-opening this, because it sounds like we're going to actually go with this approach for now and later make the change to what is in #847 😅

@mportiz08 mportiz08 reopened this Jun 3, 2024
@mportiz08 mportiz08 marked this pull request as ready for review June 3, 2024 22:53
@mportiz08
Copy link
Contributor Author

@swift-ci test

@mportiz08 mportiz08 merged commit 4559767 into swiftlang:main Jun 3, 2024
1 check passed
mportiz08 added a commit to mportiz08/swift-docc-render that referenced this pull request Jun 3, 2024
Resolves: rdar://128997251

Co-authored-by: Vera Mitchell <[email protected]>
marinaaisa pushed a commit that referenced this pull request Jun 4, 2024
Resolves: rdar://128997251

Co-authored-by: Vera Mitchell <[email protected]>
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.

3 participants