KronicDeth / intellij-elixir

Elixir plugin for JetBrain's IntelliJ Platform (including Rubymine)
Other
1.83k stars 153 forks source link

Unable to rollback with formatting on save enabled #2708

Open nulian opened 2 years ago

nulian commented 2 years ago

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.

KronicDeth commented 2 years ago

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 commented 2 years ago

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

nulian commented 2 years ago

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.

KronicDeth commented 2 years ago

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