Closed unicornware closed 10 months ago
We should add it to options, but I don't know how, because there are many tags, maybe developer doesn't want to add all of them to options
I like to make a built-in standard sort, I don't find anything about that, but this is for javadoc https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html#orderoftags
This is an example of phpDoc https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#1-functions-class-methods
Yes i'm having issues with examples being sorted before param
Strongly recommend this feature.
If customizing the TAGS_ORDER
is very complicated, then at least can set a switch to decide enable the plugin to sort automatically.
Or another inspiration, maybe can use default and override weights to sort?
e.g.
Default:
const DEFAULT_TAGS_ORDER = {
REMARKS: 100,
PRIVATE_REMARKS: 200,
PROVIDES_MODULE: 300,
MODULE: 400,
...
}
Customize (From plugin options)
const CUSTOMIZE_TAGS_ORDER = {
PROVIDES_MODULE: 301
}
Then merge these two
const TAGS_ORDER = {
REMARKS: 100,
PROVIDES_MODULE: 300,
PRIVATE_REMARKS: 301,
MODULE: 400,
...
}
Adjust getTagOrderWeight
function getTagOrderWeight(tag, options) {
if (tag === DESCRIPTION && !options.jsdocDescriptionTag) {
return -1;
}
const index = TAGS_ORDER[tag] ?? -1;
return index === -1 ? TAGS_ORDER['other'] : index;
}
But the disadvantage is that all weight values must be listed on the description page for developers to view, which will make the description page a lot of content.
jsdocTagsOrder added to options
Released v1.3.0
Description
I'm attempting to integrate this plugin into my workflow, but I'm finding that the plugin automatically sorts jsdoc tags.
I already take the time to order my tags exactly the way I want them, so I do not want the plugin altering my order.
Example
becomes
The plugin has dramatically changed the ordering of my tags (and even threw in some unwanted formatting with my
@example
tags).Additional Context
README