Search code examples
javascriptintellij-ideacoding-stylecommentswebstorm

Convert JS line comments to spaced block comments in IntelliJ IDEA


I'm working in IntelliJ IDEA cleaning up some Javascript code to match a code style standard.

My goal is to change this:

// A comment
// About some things
// That spans multiple lines

into this:

 /**
  * A comment
  * About some things
  * That spans multiple lines
  */

...without having to manually edit each and every comment block.

I know that IntelliJ has a Comment with Block Comment feature, but when I select a block and use that I can only get it to generate this:

/*A comment
About some things
That spans multiple lines*/

Does IntelliJ support the JSDoc style of comments?


Solution

  • There is no feature in IntelliJ IDEA that could automatically convert an existing sequence of end-of-line comments into a JSDoc comment. To perform such a conversion automatically, you can write a simple plugin, or just write a script that would perform the conversion when invoked from the command line.