Open AdamYoblick opened 3 years ago
Is Visual Studio invoking black --diff
? I think we print a special diff message saying "No newline at end of file".
I'm not sure, let me dig into the exact command VS is running and I'll report back.
Looks like the Python Tools extension invokes it, and indeed with --diff
.
Thanks, then we're probably hitting this: https://github.com/psf/black/blob/b1d060101626aa1c332f52e4bdf0ae5e4cc07990/src/black/output.py#L72 . We added that in #1897 for some fairly involved reasons.
This looks like a PTVS bug to me. \
is a valid patch mode, per the GNU diffutils docs.
Anyway, looks like this was resolved on the PTVS side (by ignoring that line of the diff and then manually doing newline fixups) so I think this should be closed.
Describe the bug
When trying to format a document in Visual Studio using the black formatter, an error is thrown when there is no newline at the end of the file. Please see https://github.com/microsoft/PTVS/issues/6752 for details.
To Reproduce
Expected behavior
The file should be formatted correctly
Environment (please complete the following information):