-
-
Notifications
You must be signed in to change notification settings - Fork 467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prettier VSCode Not Consistent With CLI #3431
Comments
I was having a similar issue. It seems to be fixed for me now after uninstalling the VS Code extension, restarting VS Code, and then installing it again. If you're using a remote container, make sure you uninstall it in the container as well as on your host. |
Restart extension host at least fixed it for me when updating Prettier. Saving tried to format |
Restarting/reinstalling the vscode hasn't fixed the divergence for me. I'm on version 11.0.0 of the extension and version 3.3.3 of prettier CLI (used via With a minimal config, the consistent differences in formatting I've observed include:
|
I'm also experiencing some discrepancies, which seem to have appeared recently. In particular, the extension is removing trailing newlines from |
I'm also having issues where the plugin formats quite differently from the CLI. We use a fork of prettier, but it is still located in |
Update: I figured out my issue. Turns out I needed to add |
Also adding to this: a missing |
Setting |
This issue has been labeled as stale due to inactivity. Reply to keep this issue open. |
In fact this problem is a bit more general can be described as 'prettier extension not being able to find prettier executable in PATH'. I am using mise to manage build dependencies and this takes care of versioning and installation itself, making the tools available on PATH, including vscode console. Still, prettier extension fails to find prettier and displays the message below on logs even for projects that do not use any package.json
While looking for package.json does makes sense, it should also look in path.
Based on the documentation where only an alternative options to use global npm modules also exists I can only assume that the extension is unable to make use on I was able to temporary force the extension to load prettier installed by mise by resolving the symlink and configuring Still this comes at a high cost: if I update mise config to use a newer prettier it will break, so it will not be portable even between projects on the same machine. We clearly need an option to allow extension to just use prettier executable from user PATH. |
Discussed in #3227
Originally posted by MarvNC December 14, 2023
I am using CLI 3.1.1 installed with npm globally. Meanwhile, my Prettier VSCode extension is v10.1.0.
I'd been mildly annoyed for a while at how it inserted random whitespaces between English and CJK text, but after doing some research I found out that this was fixed in the 3.0 release. After some debugging I found that using
prettier --write .
would not insert the random whitespaces, but the VSCode extension would.What should I do to debug this? Is there a way to update the version of prettier used within the VSCode extension or force it to use the same globally installed version? Reading the FAQ on the extension page it seems it should be using 3.0.0 as the extension is past version 10.
Log
The text was updated successfully, but these errors were encountered: