Javascript Comment Indentation Off?
I've noticed with IntelliJ IDEA 2017.2 that when creating a comment block in a .js (JavaScript) file, the indentation of the closing comment mark is off by one space. The problem with this is that if you press the enter key afterwards, all of your function declarations will be off by one space as well.
Here's a screenshot of what I mean:
http://i.imgur.com/trF5zZO.png
Here's a larger example which shows how the indentation gets messed up by this:
http://i.imgur.com/3jh6Hvu.png
Is there a setting that I'm missing to make these comment blocks close on the same indentation column as the starting column? Or could this be a bug within IDEA?
Please sign in to leave a comment.
Block comments have always been indented this way (with asterisks aligned). But it doesn't seem to affect the code indenting - to me, function beneath the comment is not indented (see the screenshot for cursor position on Enter)
That is strange that you don't have the same behavior but it gives me hope that there may be a solution out there. Here's an animation of the problem in real-time:

I just realized that this issue goes away if I enable "Smart Indent" in settings. I had it turned off because it tends to screw up things quite often when refactoring existing code. So it would appear that "Smart indent" knows to go back 1 space when you hit enter after creating a comment block
when 'Smart indent' option is enabled, the next line is indented according to current code style settings, respecting the code structure on hitting Enter. Otherwise, the next line is indented to the same level as above one regardless of code style settings. So IDEA works as designed