I have added a .prettierrc to the root of a project i am working on and have set tabWidth to be 4. When i format a document the code gets formatted but the tab width is 2 spaces wide. This happens to all types of files (.js, .scss, .css, etc).
In the VSC User Settings i have also "editor.tabSize": 4,
I am using the latest versions of VSC and Prettier on Windows 10. Can anyone tell me why i can't change the tab width?

Looks like you've confused the vscode settings with the Prettier settings. It should simply be "tabWidth": 4 rather than prettier.tabWidth.
If you press ctrl-space you should get completions
@azz You're right, when i removed "prettier" before the variables it started working. Thank you!
I'm having the exact opposite issue. On a default installation of VSCode with only Prettier installed, it works fine (i.e. formats on save and uses two spaces per indent) for my basic files, eg. server.js, app.js and one of the data files data/data.js. but one particular file called data/cities.js gets 4 spaces per indent. I created a new file called data/testing.js with the same content, but it still gets 4 spaces. I have modified no settings (other than turning off semi-colons) and I have no ignore file or anything else.
I had to disable editor.detectIndentation and then set editor.tabSize to 2 for these particular files to get 2 spaces. Is there any way to check the Prettier log to see what's happening or if it's even being used?
You can check Prettier's output by opening the terminal panel, going to Output and selecting Prettier from the dropdown.
Keep in mind that your editor's tabSize AND prettiers need to match
Even without them matching, the other .js files were being formatted just
fine with Prettier. It's only these certain files that don't work. I hope
setting the native tabSize doesn't affect my Python and PHP code...
I'll look for the output.
On Sun 24 Feb, 2019, 2:17 PM Boris Yordanov, notifications@github.com
wrote:
You can check Prettier's output by opening the terminal panel, going to
Output and selecting Prettier from the dropdown.Keep in mind that your editor's tabSize AND prettiers need to match
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/prettier/prettier-vscode/issues/340#issuecomment-466750211,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAE2LJ0tUADT1Wlxy7b7WKTbYkc8Wnz5ks5vQlG1gaJpZM4RldHA
.
@aalaap Try changing the indentation settings on the files that aren't being formatted - https://stackoverflow.com/questions/34174207/how-to-change-indentation-in-visual-studio-code/51607879
All of them are .js files. The ones that get formatted correctly as well as
the ones that don't.
On Sun 24 Feb, 2019, 3:03 PM Boris Yordanov, notifications@github.com
wrote:
@aalaap https://github.com/aalaap Try changing the indentation settings
on the files that aren't being formatted -
https://stackoverflow.com/questions/34174207/how-to-change-indentation-in-visual-studio-code/51607879—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/prettier/prettier-vscode/issues/340#issuecomment-466754567,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAE2LPPRPWDORi2QF3XHe5y-5Yf9sZkLks5vQlxlgaJpZM4RldHA
.
I'm not sure what you mean by that. I suggested you check the indentation settings of the files using the link i sent. I never said anything about changing their format.
Are you sure you're not accidentally using the VSCode default formatter? Quick way to check is:
console.log ( 'test' )// prettier-ignore comment above the codeThis 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
Looks like you've confused the vscode settings with the Prettier settings. It should simply be
"tabWidth": 4rather thanprettier.tabWidth.