0

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.

RaT
  • 1,134
  • 3
  • 12
  • 28

1 Answers1

5

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"

Mike James
  • 101
  • 4