When I use the default commenting shortcut in IntelliJ (cmd + /
) it inserts the //
comment line at the first position of the line like so:
Coming from vscode / javascript, I’m used to the commenting shortcut tucking the comment in directly to the left of the text of a line, preserving the indents:
Is there a way to modify the IntelliJ shortcut so that it comments the line of code using the format from the second example, rather than the first?
Advertisement
Answer
Go to Preferences | Editor | Code Style | Java > Code Generation and untick “Line Comment at first column” checkbox: