1

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 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.