prettier/prettier-vscode

The vscode extension is inconsistent with the default value of the prettier configuration file

a81n9 opened this issue · 4 comments

I found that the default configuration of the prettier vscode extension is inconsistent with the prettier configuration file.

For example, the default configuration of prettier vscode extended trailingComma is es5, while the default configuration of prettier configuration file is all.

Prettier vscode Extension

Prettier options

I had exactly this problem - it's becuase the version of prettier itself bundled inside the vs code extension is an old version (2.8) which has a different default value for the trailing comma parameter

as suggested somewhere in the documentation, if you npm install prettier on your machine (either globally or in the project, the vs code extension will use this version and so you will get the latest defaults

@timrobinson33 I was running into this issue even when prettier 3 was locally installed and I had pointed the extension at that executable.

I'm pretty sure VSCode settings defaults are static anyway, and it would be impossible to change them based upon the locally installed prettier.

It baffles me that anyone benefits from being able to configure prettier format in their VSCode settings.

@timrobinson33 I was running into this issue even when prettier 3 was locally installed and I had pointed the extension at that executable.

Hmm I'm not sure what you were seeing. the documentation says:

"Should prettier not be installed locally with your project's dependencies or globally on the machine, the version of prettier that is bundled with the extension will be used."

and also:

"Prettier's preview version 3 is supported as of version 9.12.0. It is not included in the extension by default, but can be used by installing locally in your project"

and this is definitely what happened for me.

TBH though there are so many different ways to configure these tools and what with prettier, eslint, tsconfig, package.json etc, not to mention all the vs code settings files, I struggle to figure out what's going on most of the time :-)

Yeah the extension can use prettier 3 but that doesn't mean it will change the default format settings in the extension. Try it in a project that doesn't declare its own format settings, you will see