Install theese two extensions:
- https://marketplace.visualstudio.com/items?itemName=kokororin.vscode-phpfmt
- https://marketplace.visualstudio.com/items?itemName=rifi2k.format-html-in-php
Use the format-html-in-php
to format the html snippets and phpfmt
to format the php snippets
Note: This solution is really not perfect. If anyone knows a simpler way, feel free to write a comment!