prettier-vscode icon indicating copy to clipboard operation
prettier-vscode copied to clipboard

Prettier not respecting indentation settings for python (tabs)

Open justingolden21 opened this issue 4 years ago • 4 comments

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 image

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.

justingolden21 avatar Nov 28 '21 21:11 justingolden21

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.

ntotten avatar Jan 02 '22 14:01 ntotten

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.

no-response[bot] avatar Jan 05 '22 14:01 no-response[bot]

Still having this issue.

Have also tried

	"[python]": {
		"editor.defaultFormatter": "ms-python.python"
	}

justingolden21 avatar Mar 17 '22 02:03 justingolden21

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/

justingolden21 avatar Mar 17 '22 02:03 justingolden21

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

ntotten avatar Aug 20 '22 20:08 ntotten

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.

github-actions[bot] avatar Nov 19 '22 00:11 github-actions[bot]