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

Python Formatting using black conflicting with prettier #136179

Closed
KunalTanwar opened this issue Oct 30, 2021 · 2 comments
Closed

Python Formatting using black conflicting with prettier #136179

KunalTanwar opened this issue Oct 30, 2021 · 2 comments

Comments

@KunalTanwar
Copy link

KunalTanwar commented Oct 30, 2021

Issue Type: Bug

VS Code version: Code 1.61.2 (6cba118, 2021-10-19T14:57:20.575Z)
OS version: Windows_NT x64 10.0.19043
Restricted Mode: No
Remote OS version: Linux x64 5.10.16.3-microsoft-standard-WSL2

Steps to Reproduce:

  1. I setup black as my default python formatter "python.formatting.provider": "black"
  2. My default formatter is prettier "editor.defaultFormatter": "esbenp.prettier-vscode"
  3. Also I have "editor.formatOnSave": true

But black is only working when I am commenting out "editor.defaultFormatter": "esbenp.prettier-vscode" from settings.json

@gjsjohnmurray
Copy link
Contributor

Doe #108447 (comment) help?

@KunalTanwar
Copy link
Author

KunalTanwar commented Oct 31, 2021

I solved my problem by

Setup Black as Python Formatter

"python.formatting.provider": "black",
"python.formatting.blackPath": "/home/<username>/.local/bin/black"

Removing prettier as defaultFormatter for python

"editor.defaultFormatter": "esbenp.prettier-vscode",
"[python]": { "editor.defaultFormatter": null }

Note : I am using WSL2

@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2021
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