Black formatter doesn't format
See original GitHub issueEnvironment data
- VS Code version: 1.32.3
- OS and version: Mac OS X 10.14.3
- Python version (& distribution if applicable, e.g. Anaconda): 3.6
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): virtualenv
Expected behaviour
black
to auto-format files.
Actual behaviour
I use black
as my main formatter. Neither when saving files nor clicking option+shift+f
my files are getting formatted. I can see the message Formatting with black
on the status bar, but nothing happens.
My black
path is set to /Library/Frameworks/Python.framework/Versions/3.6/bin/black
, and when I use the command line to run the following command, the file is getting formatted.
/Library/Frameworks/Python.framework/Versions/3.6/bin/black FILE_TO_FORMAT
If I choose a different formatter as default, say autopep8
, everything works correctly.
More information
- I edited
black
path to beautopep8
’s path, still doesn’t format. - I edited
autopep8
path to beblack
’s path, still nothing. - When setting
black
path toblack
and installingblack
onvirtualenv
, it works.
Steps to reproduce:
- Select
black
as VSCode formatter - Save a file or type
option+shift+f
- Now run
black FILE_TO_FORMAT
in command line for verification
Logs
Nothing mentioning black
.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Formatter black is not working on my VSCode...but why?
Try running black from the command line to see if there are error messages. This is what I got: $ black my_code.py error:...
Read more >Black formatting is not applied (but black runs) #18561 - GitHub
Issue Type: Bug Behaviour When formatting a *.py file with black, no changes are applied. I can see in the log black being...
Read more >The Black code style - Black 22.12.0 documentation
Black ignores previous formatting and applies uniform horizontal and vertical whitespace to your code. The rules for horizontal whitespace can be summarized as: ......
Read more >Setting up python Black on Visual Studio Code | by Marco Belo
Type “format on save” at the search bar on top of the Settings tab and check the box. Search for “python formatting provider”...
Read more >Black Formatter - Visual Studio Marketplace
Disabling formatting with black. If you want to disable Black formatter, you can disable this extension per workspace in Visual Studio Code.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have the same issue, but only with black 19.3b0; try downgrading it to 18.9b0 and see if that works
@AdamGold, that’s great! I’m concerned that we didn’t determine if there’s a bug, but I’m glad it’s working for you now. 😃