-
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
Extension does not seem to use the local pyproject.toml
#519
Comments
I have the same problem. I have Black settings in my {
"cwd": "/workspaces/core-service",
"workspace": "file:///workspaces/core-service",
"args": [],
"path": [],
"interpreter": [
"/home/vscode/.cache/pypoetry/virtualenvs/core-service-Td9uKyt_-py3.12/bin/python"
],
"importStrategy": "fromEnvironment",
"showNotifications": "off"
} My |
Can you try running it using this command line? The extension jsut run
|
Additionally, you can use |
Thanks for responding! I used the black-formatter args directly to set the line-length configuration and my files were being formatted incorrectly but I found the real issue. I have black as my default formatter for python files in my VSCode settings but VSCode was still using the autopep8 extension to format. Uninstalling this extension fixed the issue and Black is now working correct. Settings are now being respected in Sorry for the false positive there. |
@MarcusVirg oof thanks for your post! I've been having the same issue for weeks. Despite having black as my formatter, vscode was still using autopep8. I don't even remember installing autopep8. When opening the command palette and typing This has been such a thorn in my side, glad I found a fix. Would be nice if we could fix the bug which is causing vscode to use autopep8, despite whatever settings one is using. |
This worked for me
|
Diagnostic Data
Behaviour
When I save my
.py
files, the extension converts single-quote strings to double-quote strings, even though I have the following in mypyproject.toml
I tried to call black directly from the command-line and it does do this, so it works as expected.
But now suddenly it stopped ignoring the single-quotes and it doesn't format them anymore. If I change my settings in
pyproject.toml
toNow, it doesn't format the single-quotes to double-quotes.
Maybe this is a cache problem?
Logs:
Outcome When Attempting Debugging Steps:
Did running it from the command line work? No
If I run
/Users/me/Library/Caches/pypoetry/virtualenvs/myproject-GRsX74iM-py3.10/bin/python -m black --stdin-filename /mydir/file.py
from the terminal, I get the errorSo, I tried
/Users/me/Library/Caches/pypoetry/virtualenvs/myproject-GRsX74iM-py3.10/bin/python -m black --stdin-filename SRC /mydir/file.py
and it works now.The text was updated successfully, but these errors were encountered: