Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
976 views
in Technique[技术] by (71.8m points)

intellij idea - Indentation of line comments’ slashes

When I use IntelliJ’s function “Comment with Line Comment” it places two slashes at the very beginning of the selected lines. The forward slashes are not indented with the rest of the code. How can I make IntelliJ obey the line indentation when placing the forward slashes?

Example code:

if (something) {
    bar();
}

Using IntelliJ’s commenting function on line 2 results in:

if (something) {
//  bar();
}

What I want:

if (something) {
    // bar();
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Go to File > Settings > Editor > Code Style > Java > Code Generation and uncheck the option "Line comment at first column".

Update Oct 2016 from @henrebotha in the comments:

As of now, there's an additional option just beneath it that says "Add a space at comment start", so this is now supported.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...