Prettier throws error "failed to resolve a parser". Prettier is selected in Workspace, User and Python > Workspace, so I'm out of ideas why the error is thrown...
["INFO" - 08:57:18] File Info:
{
"ignored": false,
"inferredParser": null
}
["WARN" - 08:57:18] Parser not inferred, trying VS Code language.
["ERROR" - 08:57:18] Failed to resolve a parser, skipping file. If you registered a custom file extension, be sure to configure the parser.
Did you by chance try to invoke the "Format Document (Forced)" command (prettier.forceFormatDocument) to trigger the formatting? (I would have asked you this with a comment first if only I had the required reputation to do so.)
I have seen the exact same error when I tried to invoke the command on a .cs file today.
Anyways, here's my...
Since this command came from the "Prettier - Code formatter" extension (esbenp.prettier-vscode), it will only use the extension itself for formatting. Invoking it on any unsupported code only produces the log output you posted. (python and csharp are two unsupported ones)
It would seem that you already have some other extension for formatting python. If that extension is working, the regular command "Format Document" (alt-shift-F / cmd-shift-F) should be enough. But even if it doesn't work, it won't produce the same log output you posted.
Chances are, our respective formatter extensions actually worked, but it did not do the specific thing(s) we had in mind.
For my .cs files, I'm still looking at why my long IF statements are not broken down into multiple lines or why it does not format my indentation on the 2nd and 3rd lines of my multi-line IF statements.
"Isn't this what every prettier should do?"
I probably got this idea from my other projects (i.e. Typescript) which have every formatting needs fulfilled.
You should probably ignore the log from prettier and focus on the log from autopep8 or the lacking of such.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With