Skip to content

Black format on save conflicts with isort on save #5545

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

Closed
sbstp opened this issue May 3, 2019 · 1 comment
Closed

Black format on save conflicts with isort on save #5545

sbstp opened this issue May 3, 2019 · 1 comment

Comments

@sbstp
Copy link

sbstp commented May 3, 2019

Environment data

  • VS Code version: 1.33.1
  • Extension version (available under the Extensions sidebar): 2019.4.12954
  • OS and version: Kubuntu 18.04
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: lastest black

Expected behaviour

My code should get formatted by black and the imports should get sorted by isort when I save my file.

Actual behaviour

Only the imports get sorted. The code does not get formatted.

Steps to reproduce:

  1. This is the relevant config section
"python.pythonPath": "/usr/bin/python3",
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
    "-l",
    "120"
],
"[python]": {
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
        "source.organizeImports": true
    }
},
  1. Type up some code with bad formatting and unsorted imports
  2. Save the file

Logs

 WARN Aborted codeActionsOnSave after 750ms

Well, it seems like this is the issue. I added

"editor.formatOnSaveTimeout": 3000,
"editor.codeActionsOnSaveTimeout": 3000,

which I saw in another issue and it fixed the problem. Perhaps something can be done upstream to make them run faster or simply increase the default timeout for that case.

@ghost ghost added the triage-needed Needs assignment to the proper sub-team label May 3, 2019
@DonJayamanne
Copy link

Closing in favor of #1357

@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label May 16, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants