Prettier indentation not working/overrides.
See original GitHub issueHello, I use the John Papa Angular essentials package. I like my editor to have indentations of 4 spaces. My editor was set at 4 spaces, and when I downloaded angular essentials (I believe) Prettier overrides that.
My settings:
{
"editor.fontSize": 14,
"editor.insertSpaces": true,
"window.zoomLevel": 1,
"editor.detectIndentation": false,
"workbench.iconTheme": "material-icon-theme",
"editor.tabSize": 4
}
I tried adding the prettier settings to keep up with the tabSize:
{
"editor.fontSize": 14,
"editor.insertSpaces": true,
"window.zoomLevel": 1,
"editor.detectIndentation": false,
"workbench.iconTheme": "material-icon-theme",
"editor.tabSize": 4,
"prettier.tabWidth": 4,
"prettier.singleQuote": true,
}
After this, my editor still specifies a tab size of 2
and when I click the spaces icon, it says configured tab size is 4. If configured is 4, why is 2 selected everywhere? I can manually click 4, on each file, but if I quit/reload the editor everything is back at 2. How can I fix my formatting?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:14 (3 by maintainers)
Top Results From Across the Web
Prettier is not indenting as specified - Stack Overflow
1. At the bottom of your Editor window, check for the 'Spaces: 2' (in case your code is getting indented with 2 spaces)....
Read more >Options - Prettier
Prettier's printWidth option does not work the same way. ... in an .editorconfig file will configure Prettier's print width, unless overridden.
Read more >Prettier | WebStorm Documentation - JetBrains
Set Prettier as default formatter · Open the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Languages & Frameworks | JavaScript | Prettier, ...
Read more >How to configure Prettier and VSCode - Gleb Bahmutov
You can configure JavaScript code auto-formatting with Prettier to work per-project. This allows you to get a consistent formatting without ...
Read more >How to use Prettier in VS Code - Robin Wieruch
If not agreed upon with your team mates, this may cause trouble. Therefore I recommend the installation of Prettier Formatting Toggle which ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

oh, ok … I seem to have fixed it …
I created a
.prettierrcfile in the root of my project with the following contentand now I get 4 spaces for indentation
The right setting to have prettier indent with 4 spaces is
prettier.tabWidth: 4@CHBaker We do not read from
editor.tabSize. It may be written 2 due toeditor.detectIndentation@jmls
editor.formatOnSaveis useless in a .prettierrc file. (you may also have a warning about that)