Skip to content

Option to let prettier determine format options instead of falling back to VSCode settings when project doesn't contain explicit prettier config #3508

Open
@jedwards1211

Description

@jedwards1211

Is your feature request related to a problem? Please describe.

There are many OSS projects that keep their code formatted with prettier with its default settings. They don't declare any explicit prettier config.

Anyone developing on a project like that needs prettier-vscode to apply the same format as running the prettier CLI would.

But prettier-vscode falls back to format options from prettier-vscode settings instead. If I could I would workaround by making the prettier-vscode settings match prettier's own defaults. But prettier has changed some defaults, for example trailing comma:

Default value changed from es5 to all in v3.0.0

(prettier-vscode still considers es5 the default)

So it's impossible to make prettier-vscode always format the way prettier would right now, without bending over backwards.

Describe the solution you'd like

An extension option: Always format the same way prettier CLI would

When enabled, if a project doesn't have explicit prettier config, prettier-vscode would ignore all format options in its own VSCode settings, and instead use the same default format options as prettier CLI. In other words, it wouldn't pass any format option values to prettier.format(...), letting prettier determine options from loading config or applying defaults.

Describe alternatives you've considered

If it were up to me I would have made this the default behavior and required users to opt into using format config from VSCode settings.

But unfortunately #3487 was rejected.

Additional context

I think it's ridiculous that the official prettier extension doesn't currently support letting the project's installed prettier control the options in all cases. Was this never a design goal? Did this use case get forgotten when people who want to format without installing prettier in projects asked for support?

It's just such an inane situation to have the official prettier extension actively cause incorrect format in a PR on a project that uses prettier, I feel so frustrated at the decisions that led to this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions