Skip to content
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

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

Open
a81n9 opened this issue Jul 2, 2024 · 4 comments

Comments

@a81n9
Copy link

a81n9 commented Jul 2, 2024

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

@timrobinson33
Copy link

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

@jedwards1211
Copy link

jedwards1211 commented Sep 3, 2024

@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
Copy link

@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 :-)

@jedwards1211
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants