I wan't to use vscode's self "vscode-typescript" to format the js file.
So i add this:
"prettier.disableLanguages": [
"javascript"
]
Then prettier doesn't work for the javascript file , but, i can't format javascript file now.
It seems that the "vscode-typescript" has also been disabled.
So does the "json" file.
I need your help >_<#@!
We had to make a choice with disabling languages and supporting multi-root.
disableLanguages still calls our formatter but does nothing as you may have
experienced. We are searching a solution. @azz is making some experiences with
this. https://github.com/Microsoft/vscode/issues/38945
If you want to always/definitely disable one or more languages, you can go
in your extension folder (action: Open extensions folder) and change the file
extensions/esbenp.prettier-vscode-0.26.0/out/src/extension.js
// replace or comment line 12 and 13 as of v0.26.0
// const languageSelector = utils_1.allEnabledLanguages();
// const rangeLanguageSelector = utils_1.allJSLanguages();
const languageSelector = [
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
'css',
'less',
'scss',
'graphql',
'json',
'markdown',
]; // remove or comment language ids you don't want
const rangeLanguageSelector = [
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
'json',
]; // remove or comment language ids you don't want (range formatter)
restart VSCode
If this isn't fixed in next update, you will have to redo thoses steps. Lines
may have changed.
prettier-vscode isn't working at all for me since the last update (26.0)
js, json, ts, tsx files do not get formatted by prettier on save or by calling format document explicitly.
Curiously enough .md files DO get formatted !
I have tried it with this setting:
"prettier.disableLanguages": [
"markdown"
]
and now tried it without (based on the comment above).
Either way, formatting is not working anymore except on markdown files.
possibly relevant user settings:
{
"prettier.eslintIntegration": true,
"editor.formatOnSave": true,
"typescriptHero.resolver.organizeOnSave": false,
"tslint.autoFixOnSave": false,
}
no .prettierignore file
thanks,
Try uninstall - install.
Is there something in the prettier's output panel ? In the developer tools ?
Thank you that worked !
There was nothing in output panel. I had never previously opened Developer Tools (though I used to use it on Atom all the time) so I don't know if it was posting anything there.
I will keep away from disableLanguages until after the next update.
Thanks for developing and maintaining this package !
prettier has updated and this problem is still here :(
vscode has default json formatter and it's much appropriate than what prettier does.
however,i have to modify the extension.js again, exlude json
hope this could be fixed next update....
@CiGit
By now, when i set the "prettier.disableLanguages" , the vscode's default formatter is also disabled.
Do i still need to modify the extension.js ?
You shouldn't have to.
There is a case where it disables general formatting:
When you use multiple folders, disabling a language L in a folder included in a parent folder where this L is enabled.
A schema is maybe easier to understand:
- FolderA (+L)
|-FolderB (-L)
- FolderC (-L)
For language L:
This is caused by the implementation: glob (without negative support)
As long as you disable prettier globally for a language (User settings) and don't enable it in other settings, it should work well.
After I added "prettier.disableLanguages": ["javascript"] and restarted VSCode Prettier stopped formatting *.js files.
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
prettier has updated and this problem is still here :(
vscode has default json formatter and it's much appropriate than what prettier does.
however,i have to modify the extension.js again, exlude json
hope this could be fixed next update....