Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you fix intellij strange string indentation?

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"); 
like image 442
Jay Avatar asked Aug 10 '13 08:08

Jay


People also ask

How do you correct an indent?

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.

How do I change the indent spacing in IntelliJ?

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.

How do I Untab in IntelliJ?

1 Answer. Show activity on this post. These are common Indent and Unindent actions, default shortcuts: Tab and Shift + Tab .

How do I indent in IntelliJ?

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.

How to reformat code in IntelliJ IDEA?

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.

How do I change the indentation in Visual Studio 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.

How does IntelliJ IDEA work?

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.


1 Answers

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"

like image 121
Lennart Avatar answered Sep 28 '22 13:09

Lennart