Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add method description for visual studio code?

On some methods, Visual Studio Code ( VSC ) automatically describes the intellisense suggestions like this :

enter image description here

How can this be done for custom code, I tried finding out on the source for this name interface: and found this piece of code :

    /** Returns a string representation of a function. */
toString(): string;

So I tried adding the same to my class method:

      /** Returns a string representation of a function. */
nowUTS()
      {

        return Math.round(Date.now()/1000);
      }

But when VSC gives this method as a suggestion, I only get this visually:

enter image description here

How should I document my class methods for visual studio code intellisense to pick up the description ?

like image 352
Vincent Duprez Avatar asked Nov 07 '25 09:11

Vincent Duprez


2 Answers

You should install jsdoc add in

enter image description here

Link download https://marketplace.visualstudio.com/items?itemName=stevencl.addDocComments

More at https://code.visualstudio.com/Docs/languages/javascript#_jsdoc-support

like image 147
Hien Nguyen Avatar answered Nov 10 '25 03:11

Hien Nguyen


You should place the documentation comment above the function nowUTS(). For reference check JSDoc documentation: https://jsdoc.app/about-getting-started.html

like image 21
Max Amorim Avatar answered Nov 10 '25 03:11

Max Amorim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!