By using eslintIntegration and the range formater, the whole document gets formatted.
Due to prettier-eslint not supporting this feature (yet?)
Alternative: Disable eslint with the range formater.
There are multiple problems with format selection:
Have you tried the range formater recently ? @josephfrazier improved it a lot :-)
1 and 2 are past issues to me.
Oh, I haven't used range formatting in a while now, ignore my comments :D
I've some ideas:
Seeing this issue in latest vscode (1.19 release) on Fedora 27 linux x64. Reporting since this has been open since quite some time. I've to manually copy the seletion to a new js file, run prettier on it and then copy it back again at the moment :sweat_smile:
I've to do work-around by: Format whole document (Shift + Alt + F) -> copy the formarted block code -> Ctrl + Z -> Paste 馃槅馃槅
I think this feature(selection format) is very necessary. Because in the multi project collaboration development of old projects, conflicts can be reduced. 馃槃 馃槃
I've turned off "prettier.eslintIntegration": false but nevertheless format selection formats all document (
Format selection formats the first common parent node which can act as a valid Program. This may be your entire file.
I've turned off
"prettier.eslintIntegration": falsebut nevertheless format selection formats all document (
This was the only thing that worked for me. Unfortunate, but Format Selection is extremely useful for me.
Still have this problem
Is there any solution for this problem?
No, the issue is with prettier-eslint not supporting range formatting. The fix from our side would be to disable range formatting when eslint integration is enabled, but that's probably not something I am going to prioritize any time soon. Happy to accept a PR though.
It also seems like prettier-eslint is mostly a dead project so it is unlikely this will get fixed. I would suggest switching to the recommended approach of integrating ESLint and Prettier
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've to do work-around by: Format whole document (Shift + Alt + F) -> copy the formarted block code -> Ctrl + Z -> Paste 馃槅馃槅