Home  >  Article  >  Web Front-end  >  ## Why Does \'Format Document\' Not Work With Prettier in .vue Files in Visual Studio Code?

## Why Does \'Format Document\' Not Work With Prettier in .vue Files in Visual Studio Code?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-10-25 18:29:46382browse

##  Why Does

Troubleshooting Prettier Formatting Issues in Visual Studio Code

When using ESlint and Prettier in a Nuxt application and switching to Visual Studio Code, formatting .vue files with the "Format Document" command may not work. To resolve this, the following steps can be taken:

  • Set Prettier as the Default Formatter:

    1. Open Visual Studio Code's Settings by pressing Ctrl comma (or File -> Preferences -> Settings).
    2. Search for "formatter".
    3. Set "Prettier - Code formatter" as the Default formatter.
  • Alternative Configuring Method:

    • If the above method does not work, try the following:

      1. Press Ctrl Shift P and search for "Configure Default Formatter".
      2. Select "Prettier - Code formatter".

Alternatively, the "Format Document with..." command (Ctrl Shift I) can also be customized to use Prettier by following the same steps mentioned above.

The above is the detailed content of ## Why Does \'Format Document\' Not Work With Prettier in .vue Files in Visual Studio Code?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn