prettier-vscode icon indicating copy to clipboard operation
prettier-vscode copied to clipboard

Per-language settings for prettier, now that it's supported by VSCode.

Open y120 opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. Prettier does not support per-language settings.

Describe the solution you'd like I should be able to use configuration like:

{
    "[yaml]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode",
        "prettier.tabWidth": 2
    }
}

Describe alternatives you've considered I'm aware of the workaround to create a .prettierrc file. However, I'm in a shared development environment, where I'd prefer not to commit or even .gitignore a .prettierrc file. While I could add it to .git/info/exclude, this feels like a kludge.

Additional context This was previously requested in #242, #312, #892, and #1467.

Since then, microsoft/vscode#26707 has been closed, so extensions should be able to support per-language settings. The following comment suggests prettier-vscode maintainers would be open to supporting per-language settings once it's supported by VSCode.

Once vscode supports it, certainly. We could do it currently, but it's really messy.

Originally posted by @CiGit in https://github.com/prettier/prettier-vscode/issues/312#issuecomment-353108596

y120 avatar Dec 06 '21 00:12 y120

Potentially even better: Allow auto or editor as a new value for prettier.tabWidth and make it let prettier use the (per-language definable) editor.tabSize for ultimate consistency also when editing.
This would make conflicting tab width settings much more unlikely.

Merlin2001 avatar Feb 08 '22 16:02 Merlin2001

Any idea on this? It's pretty annoying for YAML :|

ekarlso avatar May 11 '22 18:05 ekarlso

This is a work in progress: https://github.com/prettier/prettier-vscode/pull/2679

ntotten avatar Aug 20 '22 20:08 ntotten

This issue has been labeled as stale due to inactivity. Reply to keep this issue open.

github-actions[bot] avatar Apr 22 '23 14:04 github-actions[bot]

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.

github-actions[bot] avatar Sep 26 '23 00:09 github-actions[bot]