prettier-vscode
prettier-vscode copied to clipboard
Prettier not respecting indentation settings for python (tabs)
settings.json
{
"editor.linkedEditing": true,
"editor.detectIndentation": false,
"workbench.editorAssociations": {
"*.ipynb": "jupyter-notebook"
},
"notebook.cellToolbarLocation": {
"default": "right",
"jupyter-notebook": "left"
},
"prettier.singleQuote": true,
"prettier.tabWidth": 4,
"prettier.useTabs": true,
"editor.formatOnSave": true,
"editor.tabSize": 4,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[python]":{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.wordBasedSuggestions": false,
},
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
},
"eslint.alwaysShowStatus": true,
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"terminal.integrated.defaultProfile.windows": "Command Prompt",
"git.ignoreMissingGitWarning": true,
"svelte.ask-to-enable-ts-plugin": false,
"security.workspace.trust.untrustedFiles": "open"
}
.prettierrc
{
"singleQuote": true,
"printWidth": 80,
"editor.formatOnSave": true,
"proseWrap": "always",
"tabWidth": 4,
"useTabs": true
}
.editor.config
indent_style = tab
indent_size = 4
Settings

I've been searching for hours on how to fix this. Prettier screws up all of the indenting in all of my files and always uses 4 spaces. I've selected tabs and indent size 4 on the bottom, set indent style and size in editor config, set the formatter for python to be prettier as well as use tabs and tab width in settings.json, and created a prettierrc with tab width and use tabs. And it STILL uses spaces.
An example of some of the many solutions I've already tried: https://stackoverflow.com/questions/48763503/prettier-is-not-indenting-as-specified
Thanks in advance.
I am not able to reproduce this issue. A lot of the time these issues are caused by various version and config settings that are difficult to duplicate. Please provide a sample Github repo that I can use to duplicate this issue. For more details see this guide.
This issue has been automatically closed because there has been no response to our request for more information from the original author. Currently, there is not enough information provided for us to take action. Please reply and reopen this issue if you need additional assistance.
Still having this issue.
Have also tried
"[python]": {
"editor.defaultFormatter": "ms-python.python"
}
Maybe it's something to do with this:
https://www.reddit.com/r/vscode/comments/fx3up5/auto_fomat_for_python_not_working/
https://stackoverflow.com/questions/65410758/problem-formatting-python-when-using-prettier-in-vscode
https://python.tutorialink.com/problem-formatting-python-when-using-prettier-in-vscode/
I still haven't received a proper repro for this as requested in my earlier comment so I am closing this. https://github.com/prettier/prettier-vscode/issues/2307#issuecomment-1003723725
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.