intellij-elixir icon indicating copy to clipboard operation
intellij-elixir copied to clipboard

Unable to rollback with formatting on save enabled

Open nulian opened this issue 2 years ago • 4 comments

I have enabled formatting on save normally the formatting works fine.

But if I use rollback from the local changes git tab it resets to before you do rollback. If I disable the formatter I can rollback without any problems.

nulian avatar Jun 08 '22 13:06 nulian

I'm not sure how to detect that the save is happening due to a rollback from the arguments that are passed

https://github.com/KronicDeth/intellij-elixir/blob/337242ce6c52a998e47f1fa57d0c2e62f58d1747/src/org/elixir_lang/formatter/MixFormatExternalFormatProcessor.kt#L28-L35

I'll ask JetBrains Slack to see if they have a solution.

KronicDeth avatar Jun 10 '22 10:06 KronicDeth

@nulian to confirm, the file is ONLY reformatted, or other changes in the file are also restored?

KronicDeth avatar Jun 10 '22 10:06 KronicDeth

If you rollback you will see the rollbacked version for a second and then it puts back like the previous data in the file I guess formatted from before the rollback.

nulian avatar Jun 10 '22 15:06 nulian

Thanks @nulian! That makes it easier: I just need to figure out how to detect that the file changed due to a rollback.

KronicDeth avatar Jun 10 '22 15:06 KronicDeth