-
Notifications
You must be signed in to change notification settings - Fork 676
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 does not support the Format Selection command #8130
Comments
Black definitely doesn't support formatting a selection, it is designed to format the entire file. Perhaps VS and/or GH Copilot is assuming the default formatter can always be used to format the selection (the text just added, for example), which is not a valid assumption. Let me try to reach out to the VS team to see what they say. |
I have been experiencing this for the last month as well, since I started using Github Co-Pilot in Visual Studio 2022 Professional. I work as a C++ developer 90% of the time so I've simply ignored the issue whilst coding in Python - previous searches for a solution only revealed the error message in VS Code and not full Visual Studio. Many thanks to the OP for the workaround - I can verify that changing the formatter for Python, and installing autopep8 solved the issue for me. |
I also have the same Problem and I'm beginner visual studio . Please where i can change the default formatter in VS from Black to PEP |
Please see #8155. I have temporarily disabled the warning window as a workaround and filed an upstream ticket under Copilot team. |
This issue has been moved from a ticket on Developer Community.
[severity:I'm unable to use this version]
(I would have been unable to use the default setup of VS without a deep dive into Google to find the answer)
Settings
I have GH Copilot and VsVim enabled in VS. I am working on a Python project. I have done no additional config.
Error
Every single thing I type prompts me nearly immediately with this dialogue box saying:
Black does not support the Format Selection command
.Root Cause
Black formatter. VS takes what Copilot suggests and then tries to format it using Black with
Format Selection
instead ofFormat File
?Fix
Change the default formatter in VS from Black to PEP
"python.formatting.provider": "autopep8",
or
Tools -> Options -> Text Editor -> Python -> Formatting -> Formatter -> autopep8
How is no one else experiencing this? I basically just installed VS and did nothing else. I'm trying to evaluate it as a replacement for PyCharm, but I'm encountering a bunch of major, basic issues like this.
Original Comments
Feedback Bot on 1/6/2025, 11:27 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
The text was updated successfully, but these errors were encountered: