-
Notifications
You must be signed in to change notification settings - Fork 37
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
Support "Format Selection" now that Black 23.11.0 adds a --line-ranges=
CLI option.
#374
Comments
@yilei If you are interested in providing a PR we are open for this. This code here needs to be updated to pass in the line range. vscode-black-formatter/bundled/tool/lsp_server.py Lines 105 to 111 in b4c4735
There is also proposed support for multiple line ranges via format ranges. That support is still not in |
Thanks for the pointer. Any pointers how to build my local version of the extension and have VS Code use it? The Contributing Guide doesn't mention this. |
You can run this to build it locally:
|
I also update the contributing guide. The requirements were a bit out dated. |
@karthiknadig Thanks for updating. But I think the correct command to build the vsix package is |
@yilei Were you able to add this support? |
@karthiknadig I'm able to make it work, but I had a hard time writing tests and make the tests run. Should I still send the PR without tests? |
Yes. I can help with tests. |
psf/black#4020 added a
--line-ranges=
option to Black and is now released in 23.11.0. See https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#line-rangesVS Code should now be able to properly support the "Format Selection" command.
Previously related: #176
The text was updated successfully, but these errors were encountered: