Feature Request: format changed lines before commit

Answered

IntelliJ already offers to reformat files before committing them. Although I like this feature I have it disabled because it imposes the risk of merge conflicts on lines I haven't actively changed. It would however be nice if IntelliJ could automatically reformat those lines I have actually changed. Either before committing or on saving the file.

3
3 comments

Could you please clarify? The Reformat option affects only changed parts, not the entire file.

An example with screenshots appreciated.

Also, there is automatic "magic" conflict resolution, isn;t it of any help with such merges?

2
Avatar
Permanently deleted user

> The Reformat option affects only changed parts, not the entire file.

Ok, now I feel a bit stupid. This is totally true. I've unchecked the auto format feature years ago maybe this has changed since then. I'll add this as default again.

 

Thx for your answer

 

> Also, there is automatic "magic" conflict resolution, isn;t it of any help with such merges?

It does not help if a team mate changes a line which was formatted by me.

1
Avatar
Permanently deleted user

Actually, this is not true at least with Idea 18.1 and groovy file. Reformat triggers whole file to be reformatted

1

Please sign in to leave a comment.