A JSP file with the following content is currently completely screwed up by reformatting. The indentation of HTML tags and JSP scriptlets according to code-blocks is completely removed, leaving an unreadable mess.
<html>
<head><title>Simple jsp page</title></head>
<body>
<% if (request.getParameter("...") != null) { %>
<p>case 1</p>
<% } else if (true) { %>
<% if (false) { %>
<p>case 2.1</p>
<% } else { %>
<p>case 2.2</p>
<% } %>
<% } else { %>
<p>case 3</p>
<% } %>
</body>
</html>
Things get much worse if you have HTML->Keep line breaks disabled.
IntelliJ should be calculating indent levels of the java code without regard to indent level of '<%' or '%>' or the indent level of the the html tags. Actually, I suppose someone might like it to indent starting at '<%', but that only works if the formatter can place the each '<%' at the right level.
It looks like IntelliJ newline indent algorithm is just looking at the enclosing indent level of the '<%' rather than backing up to the last line of java code.
For example,
<%
int a;
%>
If I move '<%' 10 spaces in, and then reindent "int a;", it will be indented starting at position of the '<%', rather than the previous last java line, or in this case, the outer class level which should be indent level 1.
<%
int a;
%>
I would rather IntelliJ ignore the position of '<%', and do
<%
int a;
%>
I guess this may be personal preference, but I think of all the code within the <% %> blocks as being part of one big method, so I want them all indented at the same level, irregardless of the position of '<%' '%>' tags and the html tags.
The current formatter does some really wierd stuff to the exmaple above like producing:
<% } else if (true) { %> <% if (false) { %>It should be enforcing the java code indentation above all else.