apply formatter only on edited code - eclipse

731 views Asked by At

I have implemented a formatter in eclipse for my code, when I try to save the changes it applies formatting on complete file.

Is it possible to apply formatter only on the changed code insted of full file?

@Edited

I want to apply this formatter on my existing files on save. suppose i have a file with 10 methods and approx 1000 lines. I have added a new method in that file and apply the save. Then I want my formatter to apply formatter only for new added method not for the existing 10 methods. I have to do it with each and every file in my project. @formatter:off annotation can't help here.

1

There are 1 answers

0
Mike James On BEST ANSWER

Yes, under preferences: Java -> Editor -> Save Actions

"Perform the selected actions on save" -> "Format source code" -> Change from "Format all lines" to "Format edited lines"