Using latest prettier with the following prettierrc file:
{
"arrowParens": "always",
"bracketSameLine": true,
"bracketSpacing": true,
"semi": true,
"experimentalTernaries": false,
"singleQuote": false,
"jsxSingleQuote": false,
"quoteProps": "as-needed",
"trailingComma": "all",
"singleAttributePerLine": false,
"htmlWhitespaceSensitivity": "css",
"vueIndentScriptAndStyle": false,
"proseWrap": "preserve",
"insertPragma": false,
"printWidth": 150,
"requirePragma": false,
"tabWidth": 3,
"useTabs": false,
"embeddedLanguageFormatting": "auto",
"overrides": [
{
"files": "*.html",
"options": {
"parser": "angular"
}
},
{
"files": ".prettierrc",
"options": {
"parser": "json"
}
}
]
}
Added also for html file the angular parser and in the prettier playground everything is working but with my vscode not. Reinstalled also prettier.
Getting this in VS Code:
@if(variableTitles().length >= 1) {
<div>
@if(variableTitles().length >= 1) {
<p>sdfdf</p>
}
</div>
}
Expacted this:
@if (variableTitles().length >= 1) {
<div>
@if (variableTitles().length >= 1) {
<p>sdfdf</p>
}
</div>
}
What did i wrong, any ideas?
Markus BenzMarkus Benz
asked May 2, 2024 at 16:07
1 Answer 1
Thx for the answer and the hint to indentation-with-angular-17-new-control-flow-in-vs-code
I added prettier in the project. Thought that the extension is using the newest prettier but that was not the case.
answered May 3, 2024 at 8:29
Sign up to request clarification or add additional context in comments.
Comments
lang-js
.prettierrcfile looks correct. Are you using Prettier v3.1 or newer?