Closed DashwoodIce9 closed 8 months ago
Noticed this issue too as I had Prettier v3.1.1 and https://github.com/prettier/plugin-xml v3.2.2 installed. The workaround of using Prettier v3.1.0 solved my issue as well
I'm pretty sure this is related to #3104
Try adding "prettier.configPath": "./.prettierrc"
to .vscode/settings.json
file (replace .prettierrc
with the file name that you use)
@lts20050703 This worked, thanks!
Prettier team, is this expected behavior?
@fisker https://github.com/prettier/prettier/pull/15363 breaks prettier-vscode config resolution..?
Use file path as we agreed https://github.com/prettier/prettier/issues/15879#issuecomment-1885212033
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.
Summary
Since prettier v3.1.1 the prettier-vscode extension does not work with prettier plugins. In the example repo linked below the Java plugin is not working. However, I have verified this to be a bug with other plugins like sh and XML as well. Formatting with
prettier
directly (running on command line) works (try runningnpm run format
in the sample repo linked below)Github Repository to Reproduce Issue
Link to a Github repo that can be used to reproduce the issue. Branch
3.1.1
has the issue. Branch3.1.0
doesn't.Steps To Reproduce:
prettier-plugin-java
as an example.node_modules
).Expected result
It should format the file.
Actual result
Does not format. VSCode says - "Extension 'Prettier - Code formatter' is configured as formatter but it cannot format 'Java'-files"
Additional information
The extension doesn't seem to be communicating to VSCode that it is capable of formatting Java files. Although it looks like it is reading the configuration correctly. If I try to format a JSON like
package.json
which Prettier supports out of the box and see the logs of the extension, it shows this -wherein it looks like that it knows that the Java plugin exists, but somehow fails to communicate that to VSCode.
VS Code Version:
Version: 1.85.1 Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2 Date: 2023-12-13T09:48:06.308Z Electron: 25.9.7 ElectronBuildId: 25551756 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Darwin x64 22.6.0
Prettier Extension Version: v10.1.0
OS and version: MacOS Ventura v13.6.3
Prettier Log Output
Bad log with v3.1.1 -
Good log with v3.1.0 -