skip to Main Content

I have two projects, both vue projects, but one project says I can’t use prettier as a formatting tool, and the other one works

You can see the screenshot below for details

The following two images indicate that the prettier is not recognized

enter image description hereenter image description here

The image below is another project that would normally have prettier selected as the default formatting tool
enter image description here

Where do I need to start with this question?

2

Answers


  1. it is possible to select prettier as default formatting tool.
    Open the Settings dialog ( Ctrl Alt 0S ), go to Languages & Frameworks | JavaScript | Prettier. Select Manual Prettier configuration and then select the Run on ‘Reformat Code’ action checkbox.

    Login or Signup to reply.
  2. It is possible to set default by editor.action.formatDocument.multiple (it’s a key) button + click which you want have as default, then you can trigger your default formatting tool by editor.action.formatDocument button

    Or you can append your config, so in C:UsersYesAppDataRoamingCodeUsersettings.json I have:

    {
        "[javascript]": {
            "editor.defaultFormatter": "esbenp.prettier-vscode"
        },
        "[jsonc]": {
            "editor.defaultFormatter": "esbenp.prettier-vscode"
        },
        "[json]": {
            "editor.defaultFormatter": "esbenp.prettier-vscode"
        },
        "prettier.enabledLanguageIds": [
            "css",
            // ...more
            "javascript",
            "yaml"
        ],
    }
    

    and make sure you have modern version of vscode(I have 1.85.0), because they once broke the updater by separating "system setup" and "user setup"

    to solve this, just over_re_install vscode

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search