WebStorm PhpStorm code reformat: how to fix comments?

Viewed 255

WebStorm and PhpStorm allow you to reformat your code to fit the coding style set in settings (e.g.: indentation space)

I'm using this measure to fix some of the many lint errors in my project but I'm stuck at one point: is it possible to reformat all // comments to begin with a space? To go from

//My comment

to

// My comment

If a comment already begins with a space character, it should be left alone.

Edit: There is an option in:

  • "Settings >> Editor >> Code Style >> {{coding lang}} >> Other tab" to set a blank space at the start of each comment (see "Comment code" section at the bottom of this image).

enter image description here

However, even with that selected, using the "Reformat code" option does not fix the comments.

1 Answers
Related