When I run "Format Document" in VS Code, an INFO notification pops up in VS Code with this message: "Sorry, but there is no formatter for 'javascript'-files installed."
However, I have prettier installed (you can see that it's there in node_modules/), and I believe I have my VS Code settings configured correctly. When I run npx prettier test.js --write, I get the expected output saved to test.js. Auto-formatting on save fails silently. What am I doing wrong?
Here is a test repo that reproduces this behavior:
https://github.com/granmoe/prettier-auto-format-issue
The message appears to come from this line in VS Code:
Closing. Uninstalling and reinstalling the extension fixed the issue.
Interesting. I've got the same issue, but even uninstalling and reinstalling doesn't fix it. Is it completely necessary to have javascript.format.enable set to false? If so, why isn't there anything mentioning that?
I'm running into this issue and not seeing what to do to fix it. HTML formatter runs fine.
This issue showed up this week only for me. You guys find any solution?
@rpedroni any solution?
@highskillzz Not really. My problem was for a specific .js file, any other file worked normally.
I uninstalled/reinstalled and didn't work on that file for a couple of days. When I returned, things were working - no idea why 🤷♂️
Everything worked fine until today. I didn't update or change anything in vs code.
But today I had the same error for typescript files:
_"Sorry, but there is no formatter for 'typescript'-files installed"_
Explicitly setting typescript.format.enable to true fixed it.
Just started seeing this too, any info I can provide to help?
Hmm restart fixed it.
Had the same issue, tried uninstalling and re-installing the extension. Nothing seemed to be working, resorted to the classic, restart your computer, and voila, we back on course 😄
Have same issue, whilst attempting to use Prettier in our Vue project (which includes a prettierrc). Uninstalling and reinstalling Prettier (and Vetur and Eslint in addition and the Vue pack) wasn't effective. Neither was a good old restart 😢
Have installed Prettier globally with Yarn in the desperate event that it helped (it didn't)
christian-kohler.npm-intellisense
christian-kohler.path-intellisense
CoenraadS.bracket-pair-colorizer
dariofuzinato.vue-peek
dbaeumer.vscode-eslint
eamodio.gitlens
eg2.tslint
eg2.vscode-npm-script
esbenp.prettier-vscode
formulahendry.auto-close-tag
formulahendry.auto-rename-tag
karyfoundation.theme-karyfoundation-themes
mauve.terraform
mikestead.dotenv
mrmlnc.vscode-duplicate
ms-mssql.mssql
mubaidr.vuejs-extension-pack
octref.vetur
PeterJausovec.vscode-docker
redhat.vscode-yaml
robinbentley.sass-indented
sysoev.language-stylus
tombonnike.vscode-status-bar-format-toggle
vscodevim.vim
wesbos.theme-cobalt2
xabikos.JavaScriptSnippets
{
"gitlens.advanced.messages": {
"suppressShowKeyBindingsNotice": true
},
"gitlens.historyExplorer.enabled": true,
"window.zoomLevel": 0,
"workbench.colorTheme": "Visual Studio Light",
"editor.lineNumbers": "relative",
"editor.tabSize": 2,
"editor.formatOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"vue"
],
"eslint.autoFixOnSave": true,
"eslint.run": "onType",
"javascript.format.enable": true,
"prettier.eslintIntegration": false,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"workbench.activityBar.visible": true,
"gitlens.settings.mode": "advanced",
"gitlens.menus": {
"editor": {
"blame": false,
"clipboard": true,
"compare": true,
"details": true,
"history": false,
"remote": true
},
"editorGroup": {
"blame": true,
"compare": true,
"history": false,
"remote": false
},
"editorTab": {
"compare": true,
"history": true,
"remote": true
},
"explorer": {
"compare": true,
"history": true,
"remote": true
}
},
"editor.formatOnPaste": true,
"editor.formatOnType": false
}
Have toggled "javascript.format.enable": true too, to no avail.
Thanks
This was resolved for me with the latest Prettier-VS Code update (1.6.0 I believe)
At the User Settings, check the box under Prettier: Eslint Integration.
Still. Neither of the solutions is working for me. There were times where it was working. I was using only ESLint's extension with Prettier as eslint plugin/config in the last few months and now realized that it isn't working if I have eslint extension disabled and if don't have in the sample project at all.
I think disabling editor's formatting is must and totally make sense, so I have
{
"javascript.format.enable": false,
"javascript.validate.enable": false,
"json.format.enable": false,
"typescript.format.enable": false,
"html.format.enable": false,
"editor.formatOnSave": true
}
Nothing. Running prettier from the terminal works fine.
Closing. Uninstalling and reinstalling the extension fixed the issue.
This is not the best solution
"javascript.format.enable": true,
I am having the same issue. Neighter reinstalling the plugin, nor restarting VSC or my machine solves it.
Setting javascript.format.enable to true also does not solve the issue. in VSC1.38.0 the line is grayed out after adding it.
EDIT: Turns out the prettier plugin was not reinstalling properly. Deleting the plugin manually after uninstalling fixed the issue for me: https://github.com/prettier/prettier-vscode/issues/388#issuecomment-371752555
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
I'm running into this issue and not seeing what to do to fix it. HTML formatter runs fine.