-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Black over Language Server Protocol and VS Code extension #2883
Comments
Hey thanks for reaching out to us! What follows are my personal comments, other co-maintainers may have different thoughts :) First a few initial questions about the LSP server and the extension:
My initial reaction is that I would prefer not owning & maintaining the LSP server or extension ourselves since it would require stretching the already limited maintenance resources this project has. The main sticking point is that I'd guess outside contributions to the open source project will (probably) require signing a CLA with Microsoft. Not a big deal for me, but I'd like to flag it up in this discussion just in case others feel more strongly. I do have a few important things to discuss / note if we do go down this route:
Although, I'm fine if we chose to own the LSP server itself since it's in Python haha
Nice! I love how responsive and fast it is! ... although that makes the logs confusing since they appear to be showing Black being run at the command line (which is always going to be relatively slow). Are they just for show since I'd assume the LSP server is actually powering the command which interacts with Black's unofficial APIs (bypassing the import time cost).
|
pylint-dev/pylint#5796 has some good discussion related to this. |
I'd be happy to retire #2512 in favor of a PR that pulls in most of the backend code from that extension. I think it makes sense for Black to (optionally, just like Owning the vscode extension is out of scope for the Black project IMO, just like we don't own other IDE integrations in general (vim being the only exception which I still disagree with). Some notes about that backend code (but again, happy to do this on an actual PR):
|
@ichard26 Our plan is to breakout formatting, linting, tooling into their own extensions. We want to make it easier for the python community to contribute new tools. Currently, most of the code in the python extension is in TS, and the amount of code needed to add a new tool support (say a new formatter) is quite large. The black extension is built out of a template, where the TS code is generic, and you probably won't have to touch. So far, I have used the same TS code, in five separate extensions. The TS code's purpose is to get the correct python path from the python extension and launch
Yes, and we plan on adding GH Action to create builds with the latest version of black for publishing. But the way it is designed now, the bundled code is fallback. The idea is that we will use the
Currently, I am calling @zsol Thanks for the feedback. |
I'm going to answer this question with a question 😁: would you find it beneficial long-term if we split it out? I was thinking we would either do it eventually or do it lazily based on community request since if non one is going to use the PyPI project for the LSP server it just becomes overhead for us. Out of all the projects we have spoken to about their respective extensions, you're the first to ask this, so if you want it I'm happy to trial it with your extension, especially if folks here are up for helping out a bit with maintaining it (and that's not asking for co-maintainership, just willing to help with a PR every so often). |
Hi. I just tried this extension. Maybe i need some other config for it to run?
|
@thelastWallE probably a bigger chance something changed in VS Code since that code was written or it's just a bug. We are hoping to get a preview release of a Black extension out soon, so you will be able to try it from the VS Code Marketplace at that point. |
Sorry for taking a long time to get back to you!
Makes sense, thanks for elaborating!
That's so clever, and I love it :)
For the sake of moving things along, I vote to keeping the LSP and extension as one project. If the community asks for it later on we can reconsider. I've sent a message to the rest of the core team so hopefully we can soon share a conclusive answer! |
We have the extension available as pre-release: https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter repository: https://github.com/microsoft/vscode-black-formatter |
The Python team for VS Code has been working on putting various tools we support behind LSP and breaking them out into their own extensions This work is now far enough along that we wanted to share the extension prototypes for your tool with you and see if you had any interest in owning the extension or the Python-based LSP server backing it yourself?
If you don't want to take on that responsibility that's totally fine and understandable! If you want to leave the extension to us we would then publish the extension on the VS Code Marketplace ourselves. We also plan to publish the extension as open source and support the extension for as long as we felt it made sense based on usage numbers. But due to the difficulty of migrating extension ownership, we wanted to ask early whether you wanted to own the extension from the start? If you did want to own the extension we would give you the code, help you publish to the VS Code Marketplace, and do anything else we can to help you be successful with this.
We have attached a zip file to this issue containing a prototype extension to give you an idea of what we are planning. You can download it, extract the
.vsix
file, and then install the VSIX to try it out python-black.zip. This prototype version was built with python 3.10 and bundles black v22.1.0 (as fallback if nothing is found in your environment).To be very clear, there's no pressure or expectations from us. We just want to make sure you as a project had an opportunity to own this extension instead of us from the get-go before the extension gained traction.
The text was updated successfully, but these errors were encountered: