-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Black produces a different output on the second pass on VS Code #1491
Comments
Thanks for the bug report! These are the more subtle kinds of bugs that harder to spot. Although IMO it seems like a VS Code issue. With a quick test, I cannot reproduce the bug running the same version of VS Code and the Python extension, but I'll try again harder later. A little note: version |
Oops! I totally confused Still, I'm not sure on how to check which version of black is using the I'll try to check if I can reproduce it in another environment. In the meantime, I suggest anybody trying to reproduce the issue to download the file instead of copying and pasting, just to be sure that autoformat on paste/save is not getting in the way of reproducing the problem. |
Okay, so I can reproduce and, yes this is probably a duplicate of #1006. This is probably attributed to the bug report on the Visual Studio Code Python extension issue tracker. |
Can't reproduce this with Black by itself. It may be an editor bug as @ichard26 mentioned above. |
Some files produce an extra newline at the end when running black. On a second pass, that line gets removed. I have not been able to reproduce it outside VS Code.
To Reproduce:
Download
example.py
and open it on a VS Code instance with thems-python.python
extension enabled (tested on v2020.5.86806, under VS Code 1.46.0. Possibly reproducible on other versions, too).Check that black is set as the default Python formatter on settings.json:
Back in
example.py
's tab, open the command palette and select Format Document.It will leave 2 empty lines at the end of the file.
Repeat step 3. It will remove one of the empty lines.
Expected behavior
Step 3 should result in an output that wouldn't change on a second pass of black (i.e., the output after step 4).
Environment:
Version: 19.10b0
Linux, Python 3.6.9
Does this bug also happen on master?
I'm not sure (see note above)
Additional context
I believe this might be a duplicate of #1006, or it could be related to this VS Code issue. Since I'm not quite sure about that, I present this as a new issue, providing a simpler minimal reproducible example
The text was updated successfully, but these errors were encountered: