Intellij keeps on formatting my strings like this, its annoying, how do I fix it so the lines all line up?
PreparedStatement p = s.prepare( "select distinct resource, uid, role "+ "from role " + "where person_uuid=? " + "order by role, resource, uid");
ie:
PreparedStatement p = s.prepare( "select distinct resource, uid, role "+ "from role " + "where person_uuid=? " + "order by role, resource, uid");
Select the text you want to adjust. Go to Home and select Line and Paragraph Spacing > Line Spacing Options at the bottom of the menu. The Paragraph dialog box opens. On the Indents and Spacing tab, select the options you want, and click OK.
Press Ctrl+Alt+S to open the IDE settings and select Editor | Code Style. Select the Detect and use existing file indents for editing checkbox. Apply the changes and close the dialog.
1 Answer. Show activity on this post. These are common Indent and Unindent actions, default shortcuts: Tab and Shift + Tab .
In Eclipse, it's possible to just highlight the code that needs indenting, right-click, and select Source > Correct indentation. Is there any method for doing the same thing in IntelliJ? Code → Reformat Code... (default Ctrl + Alt + L) for the whole file or Code → Auto-Indent Lines (default Ctrl + Alt + I) for the current line or selection.
In the editor, select a code fragment you want to reformat. From the main menu, select Code | Reformat Code or press Ctrl+Alt+L. If you don't select a code fragment, IntelliJ IDEA will reformat the whole file. Either open your file in the editor and press Ctrl+Alt+Shift+L or in the Project tool window, right-click the file and select Reformat Code.
While in the editor, select the necessary code fragment and press Ctrl+Alt+I. If you need to adjust indentation settings, in the Settings/Preferences dialog (Ctrl+Alt+S), go to . On the appropriate language page, on the Tabs and Indents tab, specify the appropriate indents options and click OK.
IntelliJ IDEA lets you reformat your code according to the requirements you've specified in your current code style scheme or the .editorconfig file. If anything is not defined in .editorconfig, it's taken from the project settings.
You can adjust the formatting in Project Settings -> Code Style -> Java -> Wrapping and Braces. The option you are looking for should be either "Method call arguments" or "Binary Expressions"
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