Why Prettier does not format code in VSCODE?

后端 未结 18 595
失恋的感觉
失恋的感觉 2020-12-07 18:39

In my Nuxt application where ESlint and Prettier are installed and enabled, I switched to Visual Studio Code editor.

When I open a .vue file and pre

18条回答
  •  有刺的猬
    2020-12-07 19:03

    This is not a problem with Prettier itself, but prettier-vscode, the VSCode extension. According to its documentation, Vue formatting is disabled by default:

    prettier.disableLanguages (default: ["vue"])

    A list of languages IDs to disable this extension on. Restart required. Note: Disabling a language enabled in a parent folder will prevent formatting instead of letting any other formatter to run

    In this case, to enable you should set "prettier.disableLanguages": []. And since this is an extension configuration, you should do it in VSCode settings file, not .prettierrc.

提交回复
热议问题