withastro / prettier-plugin-astro

Prettier plugin for Astro
Other
479 stars 36 forks source link

🐛 BUG: tabWidth not working #377

Closed marcelluscaio closed 1 year ago

marcelluscaio commented 1 year ago

Describe the Bug

I am using the vsCode extension and I added the package through npm. I have a config file .prettierrc it is as follows:

{ "plugins": ["prettier-plugin-astro"], "trailingComma": "all", "useTabs": true, "semi": true, "singleQuote": false, "jsxSingleQuote": false, "singleAttributePerLine": true, "proseWrap": "preserve", "printWidth": 85, "astroAllowShorthand": false, "tabWidth": 4 }

The other settings are working, but the tab width one is not

Steps to Reproduce

This is the repo: https://github.com/marcelluscaio/PFWCESWebsite/tree/saveMoney

Princesseuh commented 1 year ago

tabWidth and useTabs are kinda conflicting options are they not? tabWidth determine the amount of spaces to indent with, but useTabs means you're using tabs instead of spaces to indent.

marcelluscaio commented 1 year ago

I don't believe they are. useTabs says if you are using tabs or spaces, and tabWidth says how big your tabs will be. This setting normally works on other non-astro projects

Princesseuh commented 1 year ago

Sorry, I'm not sure I understand. A tab is one character, it's always the same size 😅 How much size it takes visually is up to your editor, not your formatter.

I can't see any difference in the formatting trying those two settings together in the Prettier playground.

marcelluscaio commented 1 year ago

You are right, I am so sorry about that!