Open ghost opened 2 years ago
Hi @ba-tno thanks for the feedback! I was able to reproduce this and also trigger it by running manually the autoformat action (Source > Format file or section with Autopep8
or by using the shortcut Ctrl + Alt + I
). I think the current way the autoformat works is replacing all the text in the formated file so that's why the breakpoints are being removed
The issue still exists but has slightly morphed in 5.2.2. The breakpoints no longer disappear completely, but they remain in the Breakpoints panel after an autoformat and actually still work (i.e. the debugger stops at the line written in the panel). However, the red dot in the margin does still disappear.
Only when the number of lines changes and the file is saved, the breakpoints disappear completely (also from the panel).
I think this happens because we're not correctly preserving line endings on Windows when formatting with Black. This should be fixed in our next version (5.3.0), thanks to some fixes I'm working on right now.
Issue Report Checklist
conda update spyder
(orpip
, if not using Anaconda)jupyter qtconsole
(if console-related)spyder --reset
Problem Description
Breakpoints disappear when I save a file with the option "Autoformat files on save" turned on.
What steps reproduce the problem?
black
as the formattera = 1
print(a)
Below gif shows the above step and the actual output:
What is the expected output? What do you see instead?
I expect that the breakpoint on line 1 stays available and is shown in the gutter.
Instead the breakpoint disappears from the gutter and also from the Breakpoints panel.
I partially understand that when autoformatting it can be ambiguous what line the breakpoint should stay at, but that's not always the case. Perhaps some logic can be applied here that keeps the breakpoints on the lines that haven't changed?
Paste Traceback/Error Below (if applicable)
Versions
Dependencies