PythonBreakpoints icon indicating copy to clipboard operation
PythonBreakpoints copied to clipboard

Conflict with Black formatter (sublack)

Open AlessioQuercia opened this issue 4 years ago • 2 comments

I am using sublack to format my code on save with Black formatter, and I noticed that formatting the code according to Black "breaks the created breakpoints". Steps to reproduce the conflict (assuming both sublack and PythonBreakpoints packages are installed):

  • create a breakpoint
  • format the code using sublack
  • the breakpoint will be split into two different lines

A possible solution is to surround the code for the breakpoint with "# fmt: off / # fmt: on" in the following way:

\# fmt: off
import pdb; pdb.set_trace()  # breakpoint aff323e8 //
\# fmt: on

I thought that there could be a flag to allow people using Black formatter to add the above lines of code instead of the original one.

I kind of implemented this, but it is still buggy. It seems that sublack interferes with this as well. It would be nice to force Black to ignore those lines. Do you think it is possible somehow?

AlessioQuercia avatar Jul 28 '21 22:07 AlessioQuercia

So I really really don't maintain this project anymore and doubt it even works with all new python 3 constructs and new ST APIs etc... But just in case.. What version of ST are you on? Also version of Python and black.

obormot avatar Jul 28 '21 22:07 obormot

Sublime Text 3 - build 4113 Python - 3.8.10 Black - 19.10b0

AlessioQuercia avatar Jul 28 '21 23:07 AlessioQuercia