Bug 445356 - [formatter] format edited lines - surrounding lines too
Summary: [formatter] format edited lines - surrounding lines too
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact: Manoj N Palat CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-29 09:42 EDT by Marcel Ackermann CLA
Modified: 2014-11-10 03:58 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel Ackermann CLA 2014-09-29 09:42:03 EDT
The option Java -> Editor -> Save Actions -> Format source code -> Format edited lines is a great new addition to Eclipse 4.2 and behaves exactly as expected, but from a usability kind of perspective a slightly different behaviour would be better: Not only format exactly the lines which have been edited since last save but also include the lines above and below and recursively if they involved a line break.

Example:
currently saved:
example("this is a method which has such a long input, that it"+
" needs to be broken at line end")

edit:
example("new param that leads to different line break", "this is a method which has such a long input, that it"+
" needs to be broken at line end")

after save:
example("new param that leads to different line break", 
"this is a method which has such a long input, that it"+
" needs to be broken at line end")

expected:
example("new param that leads to different line break", 
"this is a method which has such a long input, that it needs to be broken"+
" at line end")

I think it should be sufficient to just include +/-1 lines of an edited line, or maybe add an option that allows formatting the whole method + javadoc of a method where one line has been edited.
Comment 1 Jay Arthanareeswaran CLA 2014-11-10 03:58:58 EST
Manoj, thanks for responding.