atom-python-black
atom-python-black copied to clipboard
Reformatting file deletes most of the file's content
It requires a couple undo commands to recover the text. Using the latest 0.7.0 in Atom 1.32.2.
Can you give me a bit more information about this? What version of atom and black. What settings you are using?
Thanks Mike
Black is 18.9b0
. I'm new to the Atom ecosystem, and I'm not sure how to give you any logs about what is happening.
Yeah, it's doing the same for me too. It'll chop off the top half or bottom half of a file sometimes. Makes my code completely invalid.
Atom: 1.33.0 x64 Mac OSX
Plugin: python-black 0.7.0
Black version: 18.9b0
Reformatting seems to work perfectly in the command-line, but when I use Atom to do it, it mangles my code.
I've had a go at recreating this and so far I cannot. Can you supply me with an example file that it breaks with? Also please let me know what settings you've got for the black plugin.
Cheers Mike
The file that breaks is this one: https://github.com/AgoraMUD/AgoraMUD/blob/room-movement/libs/account.py
Here are my settings:
- Path to black executable:
Default: black
- Format on save:
True
- Maximum line length:
79
- Errors:
Show until dismissed
- Skip numeric underscore normalization:
False
- Skip string normalization:
False
- Keybindings:
Enable
(ctrl-alt-c to format)
(Well, one of the files anyway.)
I have the same problem. One of my python scripts has ~ 2000 lines, after I formatted with Black Pack (Alt + Ctrl + C), the script only has ~ 200 lines.
My setup:
- SO: Ubuntu 18.04
- Atom : 1.33.0
- Electron: 2.0.11
- Chrome : 61.0.3163.100
- Node : 8.9.3
- black: 18.9b0
- python-black package: 0.7.0
- python-black:
- binPath: "black"
- fmtOnSave: true
- lineLength: 88
- skipStringNormalization: false
- skipNumericUnderscoreNormalization: false
- showErrors: ["show", "hide", "flash"]
I have the same issue with almost the same config
Atom: 1.33.0 x64 Mac OSX
Plugin: python-black 0.7.0
Black version: 18.9b0
Just a bump to say this is still a problem. The file I was editing had ~300 lines, and goes down to <100 lines after running Black.
EDIT: Seeing how this project appears dead, my solution was to switch to atom-beautify. Since atom-beautify doesn't support configuring many Black options, I just edited the Black library locally to have the default configuration I wanted.
Yup! Bump again - this just happened to me. Switching to something else