joslarson / black-vscode

Deprecated: VS Code extension to format Python code using Black
https://marketplace.visualstudio.com/items?itemName=joslarson.black-vscode
BSD 3-Clause "New" or "Revised" License
9 stars 1 forks source link

Add information about formatOnSave to readme #14

Closed paddie closed 6 years ago

paddie commented 6 years ago

Adds some information about how to execute the extension and how to trigger it on save.

5

bocklund commented 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"?

paddie commented 6 years ago

Oh, I like this better..

shivas commented 6 years ago

:+1: fixed my issues too, adding editor.formatOnSave: true

joslarson commented 6 years ago

@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`.
joslarson commented 6 years ago

@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.

paddie commented 6 years ago

@joslarson Alright, took in your comments and I'm also attempting to use the official approach now.

paddie commented 6 years ago

@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