Skip to content
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

YAPF seems to only run sometimes #1325

Closed
joshburkart opened this issue Apr 6, 2018 · 2 comments
Closed

YAPF seems to only run sometimes #1325

joshburkart opened this issue Apr 6, 2018 · 2 comments

Comments

@joshburkart
Copy link

joshburkart commented Apr 6, 2018

Environment data

  • VS Code version: 1.21.1 (1.21.1)
  • 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

  1. Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

    1. No yapf-associated logs are produced...
  2. Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

    1. Nothing.
@MikhailArkhipov
Copy link

MikhailArkhipov commented 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.formatOnSaveTimeout

@joshburkart
Copy link
Author

Thanks for the info! I'll close this, since it's not a Python extension issue.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants