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

Add support for black's daemon, blackd #3336

Closed
pelme opened this issue Nov 14, 2018 · 9 comments
Closed

Add support for black's daemon, blackd #3336

pelme opened this issue Nov 14, 2018 · 9 comments
Labels
area-editor-* User-facing catch-all area-formatting feature-request Request for new features or functionality needs PR Ready to be worked on

Comments

@pelme
Copy link

pelme commented Nov 14, 2018

Black has a new feature called blackd:

https://black.readthedocs.io/en/stable/blackd.html

blackd is a small HTTP server that exposes Black’s functionality over a simple protocol. The main benefit of using it is to avoid paying the cost of starting up a new Black process every time you want to blacken a file.

Supporting it out of the box would be useful and probably speed up formatting!

@DonJayamanne DonJayamanne changed the title Support blackd Add support for black's daemon Nov 14, 2018
@DonJayamanne DonJayamanne added feature-request Request for new features or functionality needs PR area-formatting labels Nov 14, 2018
@olivierdalang
Copy link

If anyone has a setup for this in the meantime, please share it here.

@gramster gramster added the area-editor-* User-facing catch-all label Oct 10, 2019
@brettcannon brettcannon changed the title Add support for black's daemon Add support for black's daemon, blackd Oct 28, 2019
@brettcannon
Copy link
Member

Another option instead of adding specific support for blackd might be using https://github.com/rupert/pyls-black.

@karthiknadig
Copy link
Member

We now have a black formatter extension, https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter please give it a try. This extension runs black over LSP, should be more performant than running black each time.

@github-actions github-actions bot removed the needs PR label Aug 9, 2022
@karrtikr karrtikr added the needs PR Ready to be worked on label Aug 9, 2022
@magnetikonline
Copy link

We now have a black formatter extension, https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter please give it a try. This extension runs black over LSP, should be more performant than running black each time.

@karthiknadig this is a revelation! having black run as a server, re-formatting is like greased lighting now. 👍 - from the description it seems this will finally make it's way back into the vscode-python extension - wonderful.

@brettcannon
Copy link
Member

this is a revelation!

Great!

from the description it seems this will finally make its way back into the vscode-python extension

That's actually not going to happen. The plan is to remove the Black support from the core extension and keep the support in the separate extension. This will make the core extension smaller as well as let us update the Black extension independently of the core extension (and this is why we are comfortable shipping a copy of Black in the extension itself).

@magnetikonline
Copy link

magnetikonline commented Oct 25, 2022

That's actually not going to happen. The plan is to remove the Black support from the core extension and keep the support in the separate extension.

Good to know @brettcannon

Worthwhile updating/deleting this line? https://github.com/microsoft/vscode-black-formatter/blob/c962ac3aa71eec9ca1471075b3a4ff832c6f6afb/README.md?plain=1#L10

If that's the case - hopefully in the end the setting can just return to "python.formatting.provider": "black", - rather than "editor.defaultFormatter": "ms-python.black-formatter", / etc. like to keep my workspace JSON's clean 😄.

@levrik
Copy link

levrik commented Oct 26, 2022

@magnetikonline But this line is exactly saying what @brettcannon wrote here.

@magnetikonline
Copy link

Ah so it does. Reading it the wrong way! 👍

@karrtikr
Copy link

Closing this issue in context of the recent comments #3336 (comment).

cc/ @karthiknadig

@karrtikr karrtikr closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-editor-* User-facing catch-all area-formatting feature-request Request for new features or functionality needs PR Ready to be worked on
Projects
None yet
Development

No branches or pull requests

9 participants