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

2

26

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?

Farra answered 23/12, 2009 at 4:24 Comment(0)
A
39

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

Acie answered 23/12, 2009 at 4:38 Comment(3)
could you add a text explaination too? The image can not be found anymore (404). Thanks!Babettebabeuf
@crush sorry for that, it's the hoster issue, I'll try to make a new screenshot.Acie
#15285411Nonrigid
C
0

For me works well: Preferences → Editor → Code Style → Java → Wrapping and Braces → Method annotations → wrap always

Curtsey answered 25/12, 2023 at 7:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.