You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extension version (available under the Extensions sidebar): 2018.3.1 (29 Mar 2018)
OS and version: MacOS High Sierra
Python version (& distribution if applicable, e.g. Anaconda): Anaconda3
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
Relevant/affected Python packages and their versions: yapf==0.21.0
Actual behavior
I have the extension configured to run yapf on save. This works fine most of the time. However, seemingly when a file gets really large and complicated, even though the extension reports that yapf ran and completed (in the status bar), the file doesn't get formatted. If I try running it a few more times (e.g. add some extra unnecessary trailing spaces somewhere), it eventually does format the code. Running yapf on the command line consistently produces the same output, meaning I believe this is a bug with either VSCode or this extension. :)
Could it be a timeout issue? yapf takes too long so the extension gives up?
Expected behavior
yapf runs every time (and reports an error somehow if it failed).
Steps to reproduce:
?
Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
No yapf-associated logs are produced...
Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)
Unfortunately, VS Code has time limit for formatting on save. Any save not completed within allocated time period is ignored with no notification to the user. We try and work around this by trying to detect if formatting produced edits but they were not applied but this workaround is not 100% bulletproof. See #624
Now, apparently you can increase the time allotted according to microsoft/vscode#41194. Not very discoverable though. Try editor.formatOnSaveTimeout
Activity
MikhailArkhipov commentedon Apr 6, 2018
Unfortunately, VS Code has time limit for formatting on save. Any save not completed within allocated time period is ignored with no notification to the user. We try and work around this by trying to detect if formatting produced edits but they were not applied but this workaround is not 100% bulletproof. See #624
Now, apparently you can increase the time allotted according to microsoft/vscode#41194. Not very discoverable though. Try
editor.formatOnSaveTimeoutjoshburkart commentedon Apr 6, 2018
Thanks for the info! I'll close this, since it's not a Python extension issue.