WebStorm PhpStorm codeformat: how to fix comments?

WebStorm and PhpStorm allow you to reformat your code to match the coding style set in the settings (ex: indent space)

I use this measure to fix some of the many lint errors in my project, but I am stuck at one point: can all comments be reformatted //

to start with a space? To go from

//My comment

      

to

// My comment

      

If the comment already starts with a space character, you should leave it alone.

Edit: there is an option:

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

enter image description here

However, even with selected, using the Convert Code option does not correct comments.

+3


source to share


1 answer


The "Add space when starting comment" option only affects the behavior of "Comment with line comment < > ( Ctrl+/

), it is not used by formatting."



There is currently no way to insert spaces in the formatting, please vote WEB-26244

+5


source







All Articles