mikehoyio / atom-python-black

Python Black for Atom editor
MIT License
20 stars 7 forks source link

Reformatting file deletes most of the file's content #14

Open laserson opened 5 years ago

laserson commented 5 years ago

It requires a couple undo commands to recover the text. Using the latest 0.7.0 in Atom 1.32.2.

mikehoyio commented 5 years ago

Can you give me a bit more information about this? What version of atom and black. What settings you are using?

Thanks Mike

laserson commented 5 years ago

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.

haxys commented 5 years ago

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.

haxys commented 5 years ago

Atom: 1.33.0 x64 Mac OSX

Plugin: python-black 0.7.0

Black version: 18.9b0

haxys commented 5 years ago

Reformatting seems to work perfectly in the command-line, but when I use Atom to do it, it mangles my code.

mikehoyio commented 5 years ago

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

haxys commented 5 years ago

The file that breaks is this one: https://github.com/AgoraMUD/AgoraMUD/blob/room-movement/libs/account.py

Here are my settings:

haxys commented 5 years ago

(Well, one of the files anyway.)

aoguedao commented 5 years ago

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:

arijitlaik commented 5 years ago

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

peterstory commented 4 years ago

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.

kmjc commented 3 years ago

Yup! Bump again - this just happened to me. Switching to something else