koxudaxi / ruff-pycharm-plugin

PyCharm plugin for ruff. This plugin provides reformat code using ruff.
MIT License
222 stars 10 forks source link

ruff format deletes code #529

Open Ragnoroct opened 3 days ago

Ragnoroct commented 3 days ago

Describe the bug ctrl+alt+L deletes my code on format. Same thing happens when it formats on save. I noticed this happening when I first tried the plugin. it was deleting the whole file though. When I tried the plugin again it deleted only my most recent changes to the file.

It was formatting it just fine before

To Reproduce Steps to reproduce the behavior:

  1. Open editor and a file
  2. Press ctrl+alt+L to format the code. It deletes the most recent code I wrote

Expected behavior It should format as if I typed ruff format in the terminal without deleting anything it should not.

Screenshots image

Environments (please complete the following information):

Additional context First time I experienced this it deleted the whole file. Second time it has been only deleting my most recent changes to the file. After a full pycharm restart it still does the same thing.

It has been deleting the whole import code section. It happens pretty consistently. I can't replicate when it happens and when it doesn't.

Is there a way for me to turn on logging?