1
votes

When I create a new html file in PHPstorm and type <div class="test"> it will auto complete the HTML DOM tag </div>. If I click enter it will automatically move the </div> tag to the proper indention.

However, I have a file that has PHP, JS, and HTML all in one. It is not ideal but it is legacy code that would take awhile to rewrite. When I type <div class="test"> it does not auto complete the closing tag. Then I click enter and type out the closing </div> tag. The closing tag is now indented like it is a child of the opening tag and I have to remove those spaces.

Not a huge deal, but pretty annoying since all my files work this way for some reason.

I believe the answer lies somewhere in telling the file which code style/code highlighting it should be using but I have no idea how to do that. Any ideas?

1

1 Answers

1
votes

Go to Settings(ctrl+alt+s)

Editor-> General -> Smart Key Tick all these options

enter image description here

And in Editor-> General -> Code Style and go to other then there is some options about indent. With the preview you can identify what is changing.