Indents after pushing Enter button in Phpstrom

I've been using PhpStorm for a long time and I haven't had this problem before. The problem is that when I type some pare tag, for example, <div></div> (there is indent from the beginning of the line) and the cursor is in the middle of this tag and after I push Enter button the closing tag just goes to the beginning of the line.

The interesting fact that in .php file everything is OK. The problem only with .html extension. I just don't know what I could do to make IDE acts like this.

I have already checked all the adjusting in the Preferences -> Code style -> HTML. Everything is the same as in PHP (and I've pushed the button "Restore Defaults").

It works like that (after pushing Enter button):



And I want it be like that:




Please reformat the file with Code | Reformat Code before hitting Enter - does the issue persist? In your post at I can see this:

I put first some indent to the tag and than push "Enter button". So the first part of the tag stays where it was, but the other goes to the beginning of the line

Looks as if you have your code formatted manually so that the indentation differs from the one you'd get when performing Code > Reformat Code. 'Smart indent' (indenting code on Enter - Settings | Editor | General | Smart Keys, Enter section) doesn't care about your manual indentation, created indents are based on code style settings rather than your manually created indents. You can turn it off - the next line will always be indented to the same level as previous in this case


Hello Elena!

Thanks a lot for your answer, but unfortunately in doesn't work. 

Firs, I Reformatted code before pushing Enter, but it didn't help. Then I turned off 'Smart indent' and the result the same. I even reinstalled the program yesterday (before that I'd deleted all the config files), but the result the same :) 

Interesting fact is that there is no problem with the .php extension. So, I will probably just work with .php extension instead of .html

Couple screenshots:



>Firs, I Reformatted code before pushing Enter, but it didn't help

In your screenshot, the div tag is definitely indented manually, the auto-formatter will never create such indents. Do you mean that this manual indenting is not changed when you perform Code | Reformat Code? This must be the issue with either the code formatting preferences or file associations... Do you have any custom plugins installed? Svelte plugin, for example, registers .html files as Svelte Html Components (,, causing similar issues


Yes, It helped! :) It was because of this Svelte plugin! I've removed it.

Now I push Code | Reformat Code and I can see changes and everything works how it should. 

But I don't remember installing it...

And again thank you a lot! :)


Please sign in to leave a comment.