Intellij: add space after double slashes in line comment

前端 未结 1 395
有刺的猬
有刺的猬 2021-02-05 03:29

Is there a way in Intellij IDEA (I\'m using version 13) to automatically add a space to line comments between the two slashes and the text:

If I enter :

相关标签:
1条回答
  • 2021-02-05 03:47

    If you press CTRL / or CMD / it will put // at the beginning of the line and the comment will be properly indented.

    //        comment with two indents
    

    For this to work Comment at first column must be checked in Editor->CodeStyle->Javascript->Wrapping and Braces->Keep when reformatting like mentioned in another answer.

    This screenshot is for Java, but it works the same for Javascript. Just choose javascript in the menu

    If you want to write multiline comment you can use CTRL SHIFT / or CMD SHIFT / That way when you go into new line, you will have one space after the comment start

        /*
        * there is space before this*/
    
    0 讨论(0)
提交回复
热议问题