Search code examples
intellij-ideacommentsphpstormwebstormrubymine

Automatic breaking of line comments in Webstorm, PHPStorm, IntelliJ IDEA


If I'm typing a very long comment over line comments, how can I get Webstorm (et al.) to rearrange the comments automatically into a paragraph that neatly lines up? Note that I'm not asking for block comments, although if a solution exists for block comments but not line comments, I'm also interested.

If you're familiar with text editors, I basically want what M-q does in emacs or gq does in vim.

My question is not this question: Php Storm : How can i automate breaking lines in PHPStorm 2.1


Solution

  • There is no internal API available on whole IDEA platform to do such things (reformat/warp comments while still keeping them as comments and not just brand new line), unfortunately.

    Hopefully it will be available in one of the future versions. Devs already working on it -- see this comment for example: http://youtrack.jetbrains.com/issue/WEB-5653#comment=27-758067


    On another hand -- please try Wrap to Column plugin -- it does the job with both line and block comments (just checked for PHP code (line and block) and JavaScript (line)).