-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Report when Black errors out #8196
Comments
Hi @ooa113y , thank you for the suggestion! We have marked this issue as "needs decision" to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 👍 votes your idea gets to help us make our decision. |
@luabud Can we change it to |
I think there are two problems here:
Could we even do 2. without having 1.? I think we can't because we need to know that black failed, so my understanding is that this is not possible with the --quiet flag. Please let me know if my assumption is completely wrong 😅 That said, my proposal would be:
|
@luabud if you run black with a failure and check the return code we can see if it differs from the error for when there's code that needs formatting (if it does that when you run w/o As for idea 1, I probably left it out as it spits out so much stuff that it makes using the Output view really hard. Perhaps we should just finally break out all the major areas of the extension into separate channels so that formatting can be hard to read but it's isolated from other things like interpreter discovery and linting commands? |
I stumbled across that issue as I too find it irritating that there is no difference in black correctly formatting a file and erroring out.
Actually running black with or without the black .\view.py
error: cannot format view.py: Cannot parse: 270:26: artifact_filename = build.get("artifacts_file").get("filename")
Oh no! 💥 💔 💥
1 file failed to reformat. vs black --quiet .\view.py
error: cannot format view.py: Cannot parse: 270:26: artifact_filename = build.get("artifacts_file").get("filename") From the Readme.md of psf/black
Maybe this helps? |
We now support https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter extension which may not have this problem, please try it out and let us know if it's still an issue. |
This feature is now available in the https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter extension. |
Currently, running Black via VS Code (specifically, it's set as my default formatter in the Python extension, so I just hit Alt+Shift+F) will produce no visible result in two cases:
autopep8
which in these cases will produce reformatted, but broken, code).These two situations are exact opposites: the first one is fully normal, the second one is really bad. There should really be some difference in behaviour between these two -- a warning or an error should pop up if Black failed to run.
The text was updated successfully, but these errors were encountered: