1.21 gigawatts
1.21 gigawatts

Reputation: 17850

How to modify the JSDoc block comment code

Can I modify the default jsdoc comment to add an additional asterisk at anew anchor?

Here is the function:

function method(param, param) {


}

Here is what VSC creates when I autocomplete /**:

/**
 * |
 * @param {*} | 
 * @param {*} |
 */

Here is what I want to modify it to:

/**
 * |
 * @param {*} | 
 * @param {*} |
 **/

Upvotes: 3

Views: 952

Answers (2)

Mark
Mark

Reputation: 182661

You could try this extension: Document This.

And then in its code at ......\.vscode\extensions\joelday.docthis-0.7.1\out\src\utilities.js on a Windows machine, edit this line:

   // sb.appendLine(" */"); // to

    sb.appendLine(" **/");

Reload the window and it seems to work.

If you type /** you will get two options: vscode's built-in jsdoc'er and the Document This version.

If you don't formerly fork this extension for your own use you may have to redo the edit if the extension is updated on the future - but it is pretty simple.

Ctrl-Alt-D+D is the shortcut.

jsdoc extension demo

Upvotes: 1

Slawomir Chodnicki
Slawomir Chodnicki

Reputation: 1545

The implementation for the current behavior is here:

https://github.com/microsoft/vscode/blob/master/extensions/typescript-language-features/src/features/jsDocCompletions.ts#L15

Currently it is not possible to change the template through configuration.

If you are willing to lose support for the dynamic inclusion of defined parameters, you can define your own snippet, as described here:

https://code.visualstudio.com/docs/editor/userdefinedsnippets

Upvotes: 1

Related Questions