Closed paddie closed 6 years ago
This looks helpful, thanks for adding this.
The default settings for me read
// Provider for formatting. Possible options include 'autopep8', 'black', and 'yapf'.
"python.formatting.provider": "autopep8"
So maybe the note about setting to "none"
should be "black"
?
Oh, I like this better..
:+1: fixed my issues too, adding editor.formatOnSave: true
@paddie Sorry, somehow I just saw this! Thanks for taking the time to create a pull request. Since support for Black just landed in the latest release of the official Python extension I've been planning to deprecate this plugin and point people to that.
But, I still think your pull request could be helpful during the transition, so if you'd like me to merge it I just have one request: switch it from a "note" to go under its own heading right below the installation section (exactly where you put it). Maybe something like this:
## Formatting in Visual Studio Code
Execute this extension using `cmd/ctrl` + `shift` + `p` and searching for “Format Document” or “Format Selection”. To execute the extension on save, set `editor.formatOnSave` to `true`.
@bocklund the "python.formatting.provider" setting comes from the Microsofts official Python extension, which, as I mentioned above, just landed support for Black. So I'd suggest setting "python.formatting.provider"
to "black"
and removing this extension entirely.
@joslarson Alright, took in your comments and I'm also attempting to use the official approach now.
@joslarson Ahh, the built in thing actually also solves an issue I had with the extension having some trouble with locales and the click
library. All sorted now that I'm using the python.formatting.provider: "black"
. Thanks for putting together this extension in the meantime though, helped me pitch it to my team and get rid of python code formatting discussions.. :D
Adds some information about how to execute the extension and how to trigger it on save.
5