0

can someone confirm how to get prettier working with visualforce pages on save in VSCode? I have tried in a fresh project but it never works.

Steps taken:

  1. SFDX: Create Project
  2. npm install
  3. SFD: Create Visualforce Page
  4. edit and save test visualforce page - prettier doesn't run...

Settings below confirmed:

  • Default formatter = Prettier - Code Formatter
  • Format on Save
  • .prettierrc is present
{
  "trailingComma": "none",
  "overrides": [
    {
      "files": "**/lwc/**/*.html",
      "options": { "parser": "lwc" }
    },
    {
      "files": "*.{cmp,page,component}",
      "options": { "parser": "html" }
    }
  ]
}

Am I missing something?

4
  • .prettierrc looks ok, check if you have any errors related to prettier on the output panel, you can filter the output for prettier only. Jun 18, 2021 at 11:28
  • No output so looks like its being ignored? Jun 18, 2021 at 11:29
  • hmm check in the package.json's script tag, if you have prettier and it should be something like this -> "prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", "prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"" Jun 18, 2021 at 11:31
  • Yep got the script and if I run from the terminal it formats correctly Jun 18, 2021 at 11:35

0

You must log in to answer this question.

Browse other questions tagged .