EJS and code view automatic formatting

The editor doesn’t seem to format .ejs documents well when there’s some EJS involved.

For example, when saving this file with some partials, it created these indents:

Any way we can customize that?

To add: if possible, it would be awesome if javascript in <script> tags gets formatted as well.
For example this javascript doesn’t indent whatsoever when saving the .ejs file.