When I try to format some JSP files in IntelliJ, all the lines start from the beginning.
What options should I change to make IntelliJ to format JSP files prettier?
Go to Settings/Preferences | Editor | Code Style, select your programming language, and open the Wrapping and Braces tab. In the Keep when reformatting section, select the formatting rules which you want to ignore and deselect those which should be applied. Reformat your code ( Ctrl+Alt+L ).
A JSP page is a text document that contains two types of text: static data, which can be expressed in any text-based format (such as HTML, SVG, WML, and XML), and JSP elements, which construct dynamic content. The recommended file extension for the source file of a JSP page is . jsp.
3 and all you have to do is go to "Settings > Editor > File Types". Under "Recognized File Types", click on HTML, then under "Registered Patterns" add *. jsp .. Nothing else is required.
IntelliJ IDEA 15
JSP is related to HTML and in HTML the children of the following tags html
,body
,thead
,tbody
,tfoot
are not indented by default.
This can be changed from File > Settings... > Editor > Code Style > HTML > Other > Do not indent children of: > remove everything from there > OK
Now you can press Ctrl + Alt + L.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With