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

Feature proposal: enhance tagDefs #298

Open
lmores opened this issue Jan 13, 2021 · 0 comments
Open

Feature proposal: enhance tagDefs #298

lmores opened this issue Jan 13, 2021 · 0 comments

Comments

@lmores
Copy link
Contributor

lmores commented Jan 13, 2021

As emerged during the discussion of PR #295 some jsdoc tags (like @module, @typedef and @callback) should not be attatched to specific code nodes but rather they should provide information to other parts of the code documentation.

In broad terms a possible approach could be to extend the tagDefs with something like

module.exports = function( ... ) {
  return {
    name: 'myTag',
    global: true,
    globalTransforms: [ ... ],
    ...
  };
};

Where globalTransforms is an array of services (similar to the already implemented transforms property) that should be run after all the other jsdoc tags have been collected.

However there might be some difficulties: one is the folllowing (outlined by @petebacondarwin). Consider the following code:

/**
 * @module
 */

/**
 * Description of foo().
 */
  function foo() {}

Then I think that both comment blocks will be processed with respect to a single doc that has the foo() function as its codeNode.
We need to find a good way to distinguish JSDOC comments that should not apply to code nodes (but rather to the file, the whole doc collection or something else...).

What do you think?

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

No branches or pull requests

1 participant