koxudaxi/ruff-pycharm-plugin

Breakpoints are removed and the caret is moved

lyphrowny opened this issue · 2 comments

Describe the bug
Breakpoints are removed when using Reformat Code with checked "Run ruff when Reformat Code". The caret jumps one position to the right. The the caret is at the beginning of the line such a jump causes the editor's view to move down

To Reproduce
Steps to reproduce the behavior:

  1. Download MRE main.txt
  2. Create new project with ruff plugin enabled, my settings: image
  3. Rename main.txt to main.py and place it into the created project
  4. Set breakpoint on line 82 (return 1, res)
  5. Place caret at the beginning of the line 82 (any other place on line 82 will just move the caret one position to the right, the editor's view will not be moved)
  6. Reformat Code
  7. See the caret jumped to the end of the line 81, the editor's view shifted (the top shown line was 62, became 61), the breakpoint was removed

Expected behavior
I expect the breakpoints remain set, the caret is not moved and the editor's view is not moved

Screenshots
Before Reformat Code

  • the caret is right at the beginning of the line 82
  • the top shown line is 62
  • breakpoint is present

image

After Reformat Code

  • the caret is at the end of the line 81
  • the top shown line is 61
  • breakpoint was removed

image

Environments (please complete the following information):

  • IDE: PyCharm 2023.2.3 (Professional Edition)
  • OS: Windows 10.0
  • Ruff Version 0.1.3
  • Plugin version 0.0.26

Additional context
Not all breakpoints are removed for some reason
Sometimes the editor's view is moved down by more than 1 line

@lyphrowny
I'm sorry for my late reply.
We should fix it.
Thank you

@lyphrowny
I have released the fixed version as 0.0.29
Thank you for you help!!