#control flow and indentation on VS CODE

18 messages · Page 1 of 1 (latest)

cold mango
#

"prettier": "^3.6.2",

.prettierrc

{
  "useTabs": false,
  "printWidth": 140,
  "tabWidth": 2,
  "singleQuote": true,
  "trailingComma": "none",
  "bracketSameLine": false,
  "overrides": [
    {
      "files": "*.html",
      "options": {
        "parser": "angular"
      }
    }
  ]
}
  • you know how to have automatic indentation with control flow
  • I looked for different solutions on the internet without success
  • to force the formatting, I select all the html --> formatting selection but not working 😦
solar flame
#

if you run npx prettier --write src/path/to/the/file/you/want does it work?

cold mango
solar flame
#

which IDE?

cold mango
#

VS CODE

#

and i have extension prettier code formatter

solar flame
#

are you sure you're not overriding that setting per-filetype?

cold mango
#

I didn't understand

solar flame
#

It looks like you're overriding that setting for json files, but just to be sure, check you're not doing the same for html

cold mango
#

Yes.
too bad, thanks anyway!

solar flame
#

Maybe you're overriding that setting per-wrokspace?

cold mango
#

I haven't configured anything.
I use as is with the extensions

solar flame
#

go back to the window you've shown before, and switch to the tab "Workspace" on the top left
Check if prettier is still set as default

cold mango
#

Ah, thanks, that's good.

When you said "by workspace," I saw the tab and selected "by project."

I went into the project and selected "prettier."

It works.

#

thanks guy !!!!!!!!!!!!!!!!!

solar flame
#

Glad you solved.