Community
Participate
Working Groups
Build Identifier: 20110916-0149 When pasting Java code, the formatter should kick in and format the code. An option to turn this on/off should be added to Preferences | Java | Editor | Typing | When pasting. If the user hits undo, the formatting should be undone. If the user hits undo a 2ⁿᵈ time, the block of code should be removed. Reproducible: Always Steps to Reproduce: 1. Change some Java code to *not* be formatted according to your Java formatter settings. 2. Copy the block of code. 3. Paste the block of code into another location. 4. Notice that the pasted block of code is not formatted according to your Java formatter settings.
Are you aware of 'Preferences > Java > Editor > Save Actions'? You can use Save actions to auto-format edited code on every save. Hence, after pasting unformatted code, press Ctrl+S => Code is formatted. With the save action available, do you really need Format on paste?
This would require that I hit Ctrl+V and Ctrl+S every time I want to paste. Also, I don't turn on auto-format with every save because the format rules can't format my code exactly how I like to read it. So, yes, format on paste is very important because the formatting is only applied to the block I am pasting and then I can fix any thing that the formatter didn't.
We already do the auto-indenting. Besides that format on save can be narrowed to changed lines only.