Handle when black times out formatting on save
See original GitHub issueEnvironment data
- VS Code version: 1.28.2
- Extension version (available under the Extensions sidebar): 2018.9.2
- OS and version: Windows 10
- Python version (& distribution if applicable, e.g. Anaconda): Miniconda Python 3.7
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv
- Relevant/affected Python packages and their versions: black 18.9b0
Actual behavior
When black fails to format on save due to timeout, there is no message in the output window, indicating this is the reason for not formatting the document.
Expected behavior
When black fails to format on save due to timeout, it would be useful to see some kind of warning about this in the output window. Not only in the developer tools console.
Steps to reproduce:
- Set
"python.formatting.provider": "black", "editor.formatOnSave": trueand save a large Python script (mine was 712 pep8-compliant rows). - Save
Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
Starting Jedi Python language engine.
Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)
WARN Aborted format on save after 750ms
Extra note
As a solution to the fact that black doesn’t format a big file, increase the default "editor.formatOnSaveTimeout": 750 to a larger value in settings.json.
However, this issue is not about that, but rather the fact that it took me hours 🤕 to figure out WHY black was not formatting on save, as I was unaware of the developer tools console.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:7 (4 by maintainers)

Top Related StackOverflow Question
This is now addressed in black extension.
Came to Github to file an issue for this! I assumed format on save was buggy due to the silent failure and was just dealing with it for about a week or two before I realized I should say something, and the process of filing an issue made me learn the timeout setting was the cause. Doubling the timeout from 750 to 1500 solved the problem for me.