简体   繁体   中英

Code formatter 'cannot format' JavaScript file

I am using Macbook and suddenly my Prettier in VSCode didn't work and show a message in the bottom bar like this:在此处输入图像描述

Here is my settings.json file:

   "editor.formatOnSave": true,
   "workbench.colorTheme": "Material Theme Darker",
   "workbench.iconTheme": "material-icon-theme",
   "editor.fontSize": 13,
   "[json]": {
       "editor.quickSuggestions": {
           "strings": true
       },
       "editor.suggest.insertMode": "replace"
   },
   "terminal.integrated.automationShell.osx": "",
   "terminal.integrated.shell.osx": "",
   "terminal.integrated.fontFamily": "\"Meslo LG M for Powerline\"",
   "editor.defaultFormatter": "esbenp.prettier-vscode",
   "[javascript]": {
       "editor.defaultFormatter": "esbenp.prettier-vscode"
   },
   "prettier.enableDebugLogs": true
     
} 

Also in the bottom right corner, it shows the check tick for Prettier like that:

在此处输入图像描述

Can someone please help me to fix it, I have been trying to uninstall and installed again Prettier or VScode but it still shows the same error message.

I know this can't be your issue because your issue is 10 months old now, but for me the version was updated a few days ago from 9.0.0 to 9.1.0 and it stopped working. I selected "uninstall/install another version" and went back to 9.0.0 and it started working again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM