Hi all,
I am copying this issue from general prettier issue tracking:
as far as I know, Prettier still doesn't support different indenting for different languages. Case in point:
This is my setup for JS:
"[javascriptreact]": {
"editor.tabSize": 2
},
"[javascript]": {
"editor.tabSize": 2
}
And this should be setting for CSS
"[css]": {
"editor.tabSize": 4
},
"[postcss]": {
"editor.tabSize": 4
}
But the CSS settings keep getting ignored, and CSS gets two spaces indent. It would be awesome if we could get this to work. Or am I doing something wrong? Thanks all!
P.S. on the original question prettier/prettier#3019 - I got an answer but that doesn't seem to be working. Any help?
Edit @cigit: link fixed
We don't read for "editor.tabSize" but "prettier.tabWidth". Du to a limitation in VSCode, you can't put "prettier.*" settings inside language specific settings. (Actually we could but that would feel like a hack)
What you can do however is create a .prettierrc file with the following content. Tweek it to your likings
{
"tabWidth": 2,
"overrides": [
{
"files": "*.css",
"options": {
"tabWidth": 4
}
}
]
}
This means:
format with a tabWidth of 2.
files ending in .css should have a tabWith of 4.
That's it, thanks @CiGit!
Thanks you @CiGit
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
We don't read for "editor.tabSize" but "prettier.tabWidth". Du to a limitation in VSCode, you can't put "prettier.*" settings inside language specific settings. (Actually we could but that would feel like a hack)
What you can do however is create a
.prettierrcfile with the following content. Tweek it to your likingsThis means:
format with a tabWidth of 2.
files ending in
.cssshould have a tabWith of 4.