How to prevent IntelliJ to stop ongoing double-slash comments on the next line?

Short version

When you click <enter>at the end of a comment, //Intellij sometimes decides to continue the comment //on the next line. How can I prevent this? Is there a parameter somewhere to disable this automation?

Long version

There is a thing that I do regularly is to break a long expression with a double slash.

Say I have a line like

boolean isHex = c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f';

and I want to break it that way

boolean isHex = c >= '0' && c <= '9' //
        || c >= 'A' && c <= 'F' //
        || c >= 'a' && c <= 'f';

Note that I want the final //one to prevent formatting in order to rejoin the strings.

- '9', //<enter>. Intellij .

boolean isHex = c >= '0' && c <= '9' //
// || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f';

.

, Intellij :

boolean isHex = c >= '0' && c <= '9' //
        || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f';

, "continue//comment after <enter>". ? , .

+4
2

, , .

+1

→ → Java → " " ​​ " ". IntelliJ formatter , .

0

Source: https://habr.com/ru/post/1681906/


All Articles