-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Files not autoformatted on save when other options that work on save are set #17716
Comments
Update - whether it works or not depends on work flow. If I just press the save button or use CTRL+S, the file is not formatted. If I run the code and it has not been saved, Spyder reformats it using black, saves the reformatted file, and then runs the file. |
No, I had to uninstall for other reasons and am back to 4.x. I don't understand how a screen capture would help, you can't see me pressing CTRL S or CTRL ALT I. |
Sorry, I can't reproduce this. Unless you give us more details, I'm afraid I'll have to close this issue. |
I have hit the same issue with Linux, both with the Debian package and the PyPI version. And I think I may have figured out where the problem lies! Here's my really simple example file: test = 3
test = test + 2
When I do ctrl-S, the blank lines are removed as I have selected all of the options in the Editor > Source code preferences pane except for "Tab always indent", but the extra spaces in However, if I turn off the options in Editor > Source code which relate to formatting the file on save, it gets passed to black and the extra spaces in |
Thanks for the additional details @juliangilbey! I can reproduce this bug now. We'll try to fix it on our next version (5.3.1), to be released in mid May. |
@dalthviz, please take care of this one. The options @juliangilbey is referring to are these ones: I think the solution for this would be to disable those options in the interface when |
Description
What steps will reproduce the problem?
Turn on auto-format on save on, with black enabled. (haven't tested with autopep8)
create a new file, input poorly formatted code such as
a = [3,
4]
press save.
inspect file in external editor to see it has not been formatted.
In spyder, press CTRL+ALT+I to format the file. You get the expected
a = [3, 4]
formatting. This proves black is working and spyder knows how to invoke it correctly.
Also, if you put several blank lines at the end of the file, when I press save the lines are correctly deleted, proving that format during save works in general (I have the check box for removing extra lines on save checked)
Versions
Dependencies
The text was updated successfully, but these errors were encountered: