3

VSCode, when showing a tool-tip for an Apex method, will show the description of that method as defined in the fairly standard format:

/**
* States that the next method definition is expected to be called in the order it appears.
*
* If a method is subsequently called out of order, will fail the test.
*
* Calling 'verify' will check that all expectations have been met, failing the test if not.
*
* 'Expectations' take lower priority than 'whens' (I.E. if a matching 'when' is defined at call time, then it will match that over the next 'expect').
*
* Define in the format:
*     expects()
*         .method( 'methodName' )
*         .withParameter( 'parameterValue' )
*         .returning( 'theValueItShouldReturn' )
*/

However, it does not take into account the formatting of the comment, and renders it much like how you would expect text within HTML to be rendered.

E.g. Example of unformatted description comment

Adding HTML or escaped characters does not help, as the tags and suchlike are rendered as is.

Is anyone aware of the format required in order to get formatting preserved, or explicitly state the formatting required?

2
  • I wonder if there is a separate apexdoc and/or JSDoc plugin you need in VSCode? I use Illuminated Cloud and IDEA as my IDE and this has good apexdoc/JSDoc support. With both types of documentation you can use a subset of HTML (such as <pre>, <p>, <dl>, <ul>, <ol> etc.) along with special tags like "@see" to correctly format the comments when rendered both within the IDE and when using a documentation generator such as SfApexDoc or jsdoc.
    – Phil W
    Aug 11 '20 at 9:12
  • 1
    I wonder the same - have raised a bug on the SalesforceDx VSCode plugin that is presumably responsible for defining this behaviour - github.com/forcedotcom/salesforcedx-vscode/issues/2409 Aug 11 '20 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.