Using the latest Prettier 2.0 CLI produces different formatting to the vscode extension even when using identical settings.
prettier-vscode extension:
const isPlayer = R.compose(
equal(player),
nameGet
)
running prettier 2.0.0 on the code from the CLI (npx [email protected] --write --no-semi "**/*.js"):
const isPlayer = R.compose(equal(player), nameGet)
Both are using the same print width setting (80). The only setting active that differs from the default is semi: false.
const isPlayer = R.compose(equal(player), nameGet)The expected result is that it doesn't change the code, as running prettier 2.0.0 via the CLI on this code does not change it.
It breaks out the code onto multiple lines.
_Feel free to attach a screenshot_.
Extension version: 4.1.1
VS Code version: Code 1.43.2 (0ba0ca52957102ca3527cf479571617f0de6ed50, 2020-03-24T07:34:57.037Z)
OS version: Darwin x64 19.0.0
Think this is probably related to what I just reported in https://github.com/prettier/prettier/issues/8000 (which I guess was the wrong place, so I closed that).
Essentially the trailingComma and arrowParens settings seem to be ignored in 4.x
Think this is probably related to what I just reported in prettier/prettier#8000 (which I guess was the wrong place, so I closed that).
Essentially the trailingComma and arrowParens settings seem to be ignored in 4.x
Why would those settings be related? There is no arrow function in the code example I gave, nor any trailing commas.
Only because the settings I mentioned also appear to be ignored in 4.x, but working in any version below it. So I figured that maybe its a more general underlying issue, rather than specific to one rule. But sure, you're probably right and it's unrelated.
I am not able to reproduce this. Please provide a sample github repo I can use to reproduce the issue.
https://github.com/Woolfe/reproduce-prettier-issue
Clone this, then format index.js using the prettier extension. The code won't change (at least, it doesn't for me). Then run npx [email protected] --write --no-semi "**/*.js" from the command line and it should reformat the code in index.js to all be on the same line.
Also seeing an issue with formatting MDX files where empty lines are removed when run through the prettier-vscode plugin, but maintained when running prettier via the CLI.
I cloned the repo and it behaves correctly. Are you sure you have prettier set as the default formatted for javascript files. Please provide the log output you see when your run prettier through VS Code. To get logs see these instructions: https://github.com/prettier/prettier-vscode/wiki/Writing-a-Good-Issue#4-always-provide-the-log-output
I'm also seeing an issue with the recent release (v4.2.0) of the VS code plugin regarding trailing commas being removed when I format a file on save. I fixed my issue by downgrading to release (v4.1.1).
I'm also seeing an issue with the recent release (v4.2.0) of the VS code plugin regarding trailing commas being removed when I format a file on save. I fixed my issue by downgrading to release (v4.1.1).
Yeah I opened an issue on this: https://github.com/prettier/prettier-vscode/issues/1323
I think the "prettier.trailingComma" etc. settings are being ignored and defaulting to hard coded values.
I think it's this commit that possibly introduced the issue: https://github.com/prettier/prettier-vscode/commit/1a8a8fc1d2012f11d50b8f0294380b3f8d9518be#diff-5f0a14a626b969e3eff17cb440ab6e41R60
Should be fixed in v4.4.0.
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.
Most helpful comment
I'm also seeing an issue with the recent release (v4.2.0) of the VS code plugin regarding trailing commas being removed when I format a file on save. I fixed my issue by downgrading to release (v4.1.1).