I used to write javascript only in vs code and everything works fine.
But now I start learning python.
When I hit ctrl-s will see this warning:
Extension 'prettier - Code formatter' cannot format "hello.py"
https://github.com/krave1986/learn_python.git
No warning about prettier presents.
Warning:
Extension 'prettier - Code formatter' cannot format "hello.py"
VS Code Version:
1.45.1
Prettier Extension Version:
4.7.0
OS and version:
Windows 10
no prettier button available in the bottom toolbar.
Saving the file will trigger the warning even if I have set .prettierignore to ignore hello.py
Prettier doesn鈥檛 support python.
For others who have met the same warning, please try to set a language-per formatter for python.
If you are like me who wants to use prettier for javascript as well as black for python, and you already have prettier set as the default editor for all languages in vs code via
"editor.defaultFormatter": "esbenp.prettier-vscode", you can set formatter specific for python:
"[python]": {
"editor.defaultFormatter": "ms-python.python",
}
ms-python.python refers to the extension - python build by Microsoft which offers formatter options for python language. The options covers:
autopep8,
black,
yapf,
none
Info from here
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
For others who have met the same warning, please try to set a language-per formatter for python.
If you are like me who wants to use prettier for javascript as well as black for python, and you already have prettier set as the default editor for all languages in vs code via
"editor.defaultFormatter": "esbenp.prettier-vscode", you can set formatter specific for python:ms-python.python refers to the extension - python build by Microsoft which offers formatter options for python language. The options covers:
autopep8,
black,
yapf,
none
Info from here