Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the Intellij code autoformatter to keep an annotated field on one line?

Tags:

Whenever I run the IntelliJ autoformatter - it converts this:

@Autowired private CustomerDao customerDao; 

into this:

@Autowired  private CustomerDao customerDao; 

How can I stop it from doing that?

like image 498
Daniel Alexiuc Avatar asked Dec 23 '09 04:12

Daniel Alexiuc


People also ask

How do I fix code format in IntelliJ?

Sometimes code formatting can get out of sync, but there's an easy fix in IntelliJ IDEA. You can use ⌘⌥L (macOS), or Ctrl+Alt+L (Windows/Linux) to reformat a selection of code according to your reformat settings.

Why is IntelliJ autocomplete not working?

I have tried the following according to this thread (Intellij IDEA CE 12 Android XML Code Completion not working): Go to File->Power Save Mode and disable it - it is off. Go to Preferences->Editor->Code Completion and check Autopopup code completion - this has been checked. Go to File->Invalidate Caches and restart.


1 Answers

Navigate to Preferences → Editor → Code Style → Java → Wrapping and Braces tab, then locate the section Field annotations and check the option Do not wrap after single annotation.

In IntelliJ v14:

eIntelliJ v14 Java style preferences

like image 177
CrazyCoder Avatar answered Oct 07 '22 15:10

CrazyCoder