apexdocs icon indicating copy to clipboard operation
apexdocs copied to clipboard

Improve descriptions when using grouping

Open cesarParra opened this issue 2 years ago • 7 comments

Taken from https://github.com/cesarParra/apexdocs/issues/45#issuecomment-1127801984. See that issue for more details

On @start-group/@end-group:

This works fine:

// @start-group Special Metadata Names
public static final String WILDCARD_SOURCE = 'CodeControl_Default';
public static final String SYSTEM_WIDE_SOURCE = 'CodeControl_Override';
// @end-group

And produces:

Special Metadata Names

  • SYSTEM_WIDE_SOURCEString
  • WILDCARD_SOURCEString

BUT, changing // @start-group ... to /** start-group ... */ does not:

/** @start-group Special Metadata Names */
public static final String WILDCARD_SOURCE = 'CodeControl_Default';
public static final String SYSTEM_WIDE_SOURCE = 'CodeControl_Override';
/** @end-group */

That produces:

Other

  • SYSTEM_WIDE_SOURCEString
  • WILDCARD_SOURCEString

Which is probably okay, but since all other directives work with the Javadoc prefix (/**) it is a bit of an exception.

Also @description does not work with either the constants or the group. For example:

// @start-group Special Metadata Names
/** @description Wildcard and Override Settings are only used for Logging and Trigger control.*/
public static final String WILDCARD_SOURCE = 'CodeControl_Default';
public static final String SYSTEM_WIDE_SOURCE = 'CodeControl_Override';
// @end-group

I suppose you could read that @description as either describing the group (which I'd prefer) or WILDCARD_SOURCE, but either way, it did not appear in the output. I tried several variations of comment styles and locations without success. My suggestion is to support two types of description - A description in the same comment block as @start-group is a group-level description, and a standalone comment is a property-level description

/** @start-group Special Metadata Names
 *  @description Wildcard and Override Settings are only used for Logging and Trigger control.
 */

/** @description Overrides all metadata */
public static final String WILDCARD_SOURCE = 'CodeControl_Default';
/** @description Used if no matching metadata found */
public static final String SYSTEM_WIDE_SOURCE = 'CodeControl_Override';
/** @end-group */

would produce:

Special Metadata Names

Wildcard and Override Settings are only used for Logging and Trigger control.

Overrides all metadata

  • SYSTEM_WIDE_SOURCEString Used if no matching metadata found
  • WILDCARD_SOURCEString

Or even better, allow in-line comments to appear in-line in the output:

/** @start-group Special Metadata Names
 *  @description Wildcard and Override Settings are only used for Logging and Trigger control.
 */

public static final String WILDCARD_SOURCE = 'CodeControl_Default'; /** @description Overrides all metadata */
public static final String SYSTEM_WIDE_SOURCE = 'CodeControl_Override'; /** @description Used if no matching metadata found */
/** @end-group */

Producing:

Special Metadata Names

Wildcard and Override Settings are only used for Logging and Trigger control.

  • SYSTEM_WIDE_SOURCEString : Overrides all metadata
  • WILDCARD_SOURCEString : Used if no matching metadata found

cesarParra avatar May 16 '22 18:05 cesarParra

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jun 17 '22 03:06 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jul 01 '22 03:07 github-actions[bot]

Please re-open; this was a feature request that hasn't been implemented yet. It's not stale, just not prioritized.

jclark-dot-org avatar Jul 06 '22 20:07 jclark-dot-org

@jclark-dot-org Yup, done. Automation picked up this one so I might need to turn that off until I can get back to this.

Few busy weeks at work so haven't been able to dedicate too much time. I did start to take a look but it might take a bit to implement since I'd need to make some changes to the way apex docs are picked up to be parsed, since this would essentially represent a new concept that currently doesn't exist, and thus ignored during parsing.

cesarParra avatar Jul 06 '22 20:07 cesarParra

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Aug 06 '22 03:08 github-actions[bot]

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Sep 06 '22 04:09 github-actions[bot]

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Oct 07 '22 03:10 github-actions[bot]

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Nov 12 '22 03:11 github-actions[bot]

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Dec 18 '22 02:12 github-actions[bot]

Added with release 2.11.0.

Groups can now be started and ended with /** */ comments. When starting the group, an @description can also be provided and that will be used as the group's description.

Any following /** */ after that will be used for the member (field, property, method, etc.) of the group, so it'd look like this:

    /**
     * @start-group This is a group
     * @description This is the group's description
     */

    /** @description Description for a member of the group */
    public static final String inGroup2;

    /** @description Description for the other member **/
    public static final String anotherInGroup2;

    /** @end-group */

cesarParra avatar Dec 21 '22 11:12 cesarParra