-
Notifications
You must be signed in to change notification settings - Fork 146
Use a more detailed page type for C++ namespaces in navigator index #817
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
Use a more detailed page type for C++ namespaces in navigator index #817
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.
Looks good to me. I would just ask that we continue to be defined the page type enum cases in the order of their raw value.
@@ -309,6 +309,9 @@ public class NavigatorIndex { | |||
case languageGroup = 127 | |||
case container = 254 | |||
case groupMarker = 255 // UInt8.max | |||
|
|||
// C++ symbols | |||
case namespace = 48 |
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.
Just for how these enum cases are organized, please add this case above the special items so that the cases continue to be defined in the order of their raw value.
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.
I also believe that this is a source breaking change since any existing code that was switching over this public enum now has a new case that it would need to handle. Maybe there's nothing we can do about it but it's worth calling mentioning.
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.
Just for how these enum cases are organized, please add this case above the special items so that the cases continue to be defined in the order of their raw value.
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.
I also believe that this is a source breaking change since any existing code that was switching over this public enum now has a new case that it would need to handle. Maybe there's nothing we can do about it but it's worth calling mentioning.
Are you aware of any way to do this in a non source breaking manner?
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.
Unfortunately I don't know of any other way. If we need to make a source breaking change it might be worth discussing if we should make a larger change now so that future changes can be made in a non-source breaking manner.
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.
I think it's OK to break source compatibility here.
@daniel-grumberg Do you think that we should add something like this |
I think that would be a great idea but let's do it as a follow up patch. |
@swift-ci please test |
@swift-ci please test |
Bug/issue #, if applicable: 122340677
Summary
This adds a new
namespace
case to theNavigatorIndex.PageType
enum that can be used inRenderIndex
to emit a more specific"namespace"
page type instead of a generic"symbol"
type in the Render Index JSON.This is needed so that Swift-DocC-Render can distinguish namespaces from other generic symbols in the navigator and render them appropriately, like choosing an icon that is specific to namespaces.
Testing
Steps:
swift run docc convert Tests/SwiftDocCTests/Test\ Bundles/CxxSymbols.docc
Foo
namespace symbol inTests/SwiftDocCTests/Test\ Bundles/CxxSymbols.docc/.docc-build/index/index.json
now has atype
value of"namespace"
and not"symbol"
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded