Skip to content
New issue

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

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

Already on GitHub? # to your account

Support Generics in Doc Entry Names #152

Open
YetAnotherClown opened this issue Aug 9, 2024 · 0 comments
Open

Support Generics in Doc Entry Names #152

YetAnotherClown opened this issue Aug 9, 2024 · 0 comments

Comments

@YetAnotherClown
Copy link
Collaborator

It is a desired practice to have Generic Types on Classes, Functions, Properties, and Types. Currently, there are several issues when using Generic Types when adding them to the names of these doc entries.

Known Issues

  • Classes with any generics, e.g. @class GenericClass<T> does not route properly, resulting in a 404 page.
  • All Doc Entries with a generic in their name will not properly be hyperlinked on the website.
  • Having multiple generics on one doc entry is impossible unless you do not separate by spaces

Implementation Notes

Moonwave shouldn't route to api/Foo<T> but instead api/Foo and hyperlinks should follow.

The name on the page should still display as Foo<T>, and when it is displayed as a type on a Function, Property, or in a Type Definition, it should also appear as Foo<T>. When it is displayed in such doc entries, the hyperlink should only apply to the Foo part and route properly to api/Foo.

It might be best to add a generics field onto the doc entries that contain their generics in order, and then name the doc entries without their generic types. E.g. Foo<T, E> will have the name Foo and a generics: ["T", "E"] field, the docusaurus-moonwave-plugin will use this field to display the generics, while the Extractor will ignore and be oblivious to them.

Some Test Cases

--- @class Foo<T>
--- This is a generic class

--- @class Bar<T, V>
--- This is a generic class with two generics

--- @class Baz<T, U...>
--- This is a generic class with generic and a generic type pack

--- @function Qux<U...>
--- All the previous syntax should also work for functions, types, and properties
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant