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

Link tag support #66

Merged
merged 5 commits into from
Oct 16, 2024
Merged

Conversation

Daniel-Knights
Copy link
Contributor

@Daniel-Knights Daniel-Knights commented Oct 16, 2024

This PR adds support for @link tag parsing, converting identifiers to their full module paths. It respects link text if it exists, if not, it uses the original identifier.

For nested member access, it just links to the root identifier, because finding what kind of member it is and constructing the namepath correctly is a bit more complicated and I don't fully understand how it works.


Some further notes on nested member access that could be added in a separate issue:

We'd need to know what kind of member it is - instance or static, property or method - and format the namepath accordingly.

To find out what kind of member it is, we could use the AST cached in fileNodes, though, that could cause an issue if the imported file hasn't been cached yet.

Using the default JSDoc template, I found links work with the Identifier#member namepath format for everything except static methods which require Identifier.member:

  • module:path/to/module.Identifier#member
    • Instance properties
    • Instance methods
    • Getters/setters
    • Static properties
  • module:path/to/module.Identifier.member
    • Static methods

Identifier#member working for static properties contradicts the docs, which says Identifier.member should be used for static members. This could be a bug in JSDoc core, a bug in the default template, or just incorrect documentation, I don't know.

Copy link
Member

@ahocevar ahocevar left a comment

Choose a reason for hiding this comment

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

This is a great addition, thanks!

@ahocevar ahocevar merged commit 5e12374 into openlayers:main Oct 16, 2024
1 check passed
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.

2 participants