Prettier-vscode: Tab width setting no longer obeyed in VS Code setting file

Created on 11 Dec 2017  路  11Comments  路  Source: prettier/prettier-vscode

These at the settings I use in the vs code setting file.

"prettier.singleQuote": true,
"prettier.tabWidth": 4

Up until today, they were working. They are now using a value of 2. The singleQuote option still works.

doc enhancement locked

Most helpful comment

Well apparently Angular CLI created one for me and there you go, it appears the indent_size is set to 2. So this value is now set in at least 3 places. The default for VS Code is 4, I have prettier set to 4 and the .editorconfig has apparently been 2 this whole time. Strange it suddenly started causing a problem only yesterday - I checked the log on the editorconfig and this file hasn't changed since july of this year.

I know there are editorconfig extensions for VS Code - I can't find if it supports editor config out of the box. I don't have any of those extensions installed. Was there a recent change to have Prettier use the editorconfig as the source of truth and VS Code simply isn't using it perhaps?

In any case, this has fixed my issue.
Thank you!!!

All 11 comments

Do you have an editorconfig file ?

Well apparently Angular CLI created one for me and there you go, it appears the indent_size is set to 2. So this value is now set in at least 3 places. The default for VS Code is 4, I have prettier set to 4 and the .editorconfig has apparently been 2 this whole time. Strange it suddenly started causing a problem only yesterday - I checked the log on the editorconfig and this file hasn't changed since july of this year.

I know there are editorconfig extensions for VS Code - I can't find if it supports editor config out of the box. I don't have any of those extensions installed. Was there a recent change to have Prettier use the editorconfig as the source of truth and VS Code simply isn't using it perhaps?

In any case, this has fixed my issue.
Thank you!!!

It looks like Prettier has suddenly started preferring .editorconfig settings over settings in VS Code. It would be a good idea to mention this somewhere.

We use prettier's resolveConfig which reads your editorconfig. I've just mentioned it in the release notes.
We should put a line on that in the readme.
PR Welcome!
code is : https://github.com/prettier/prettier-vscode/blob/067545ed33fd1d82dea38edaceef2bf09b8d840e/src/PrettierEditProvider.ts#L37-L63

Cool. Man this can get confusing with extensions are using the editor config and the _editor_ is not. It was driving me nuts getting a 4 space tab when I was working mixed in with the prettier 2 space tab every time I saved.

It was a feature request, reading the editorconfig file. Prettier does it, so we do.
I'll let this opened for now, until we have updated the readme

I don't understand, is there something we can do to ignore prettier's configuration?

Which config do you want to ignore?

honestly? I forgot. I think I had vscode settings and .editorconfig playing together nicely, but prettier as said above prefers .editorconfig, so I ended up commenting out

indent_size = 2

from .editorconfig

If you have a prettier config file next to your editorconfig with a tabwidth setting, it will be prefered.
closing as this is now documented https://github.com/prettier/prettier-vscode#prettiers-settings

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GantMan picture GantMan  路  3Comments

ZiiMakc picture ZiiMakc  路  4Comments

DanielHabenicht picture DanielHabenicht  路  4Comments

Levdbas picture Levdbas  路  4Comments

peralmq picture peralmq  路  3Comments