3

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?

asked May 2, 2024 at 16:07
3

1 Answer 1

0

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.