mikehoyio / atom-python-black

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

Buffered output results in truncated output #27

Closed QuantumEntangledAndy closed 3 years ago

QuantumEntangledAndy commented 3 years ago

OS: Mac atom-python-black Version: 0.7.0

When I run this on a script about 400 lines long,

only the last hundren lines or so is kept.

I looked into this and believe it occurs here:

https://github.com/mikehoyio/atom-python-black/blob/f635f7fa2845eba95c362da92f1bdf6ada7337ce/lib/python-black.js#L130-L146

Some testing shows that

stdout: out => {
    textEditor.setText(out);
},

Is called several times with the output buffered into chunks of 100 or so lines

This means that the editor is set to only the last chunked output.

Ideally the setText should only called after the process has finished and all text is avaliable.

QuantumEntangledAndy commented 3 years ago

Nevermind I see that this is a duplicate of #14 and that #16 should fix it if it ever gets merged...