2

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 ?

Vincent Duprez
  • 3,772
  • 8
  • 36
  • 76

2 Answers2

4

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

Hien Nguyen
  • 24,551
  • 7
  • 52
  • 62
2

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

Max Amorim
  • 147
  • 1
  • 13
  • Yes! Just edited my question to give another example and found this one out, always when I asking that the solutions pops out.. thank you – Vincent Duprez Apr 23 '20 at 12:17