prettier-vscode
prettier-vscode copied to clipboard
Prettier code format take a long time to format
Type: Bug
I dont know why but my prettier take about 1-2s to format.

Extension version: 9.12.0 VS Code version: Code 1.77.3 (Universal) (704ed70d4fd1c6bd6342c436f1ede30d1cff4710, 2023-04-12T09:19:37.325Z) OS version: Darwin arm64 21.4.0 Modes: Sandboxed: Yes
System Info
| Item | Value |
|---|---|
| CPUs | Apple M1 Pro (8 x 24) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled metal: disabled_off multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
| Load (avg) | 5, 5, 4 |
| Memory (System) | 16.00GB (1.41GB free) |
| Process Argv | --crash-reporter-id b70f3c63-e04c-4015-8b63-1803fe3fdfa6 |
| Screen Reader | no |
| VM | 0% |
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscoreces:30445986
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
vsccc:30610678
nodejswelcome1cf:30587006
3biah626:30602489
pyind779:30671433
f6dab269:30613381
pythonsymbol12:30671437
a9j8j154:30646983
vsctsb:30705553
azdwalk:30721579
pythonms35:30701012
pythonfmttextcf:30716743
Same. If I use "developer: reload windows", it's perfect again for a little while. But 20 seconds later, saving is slow again.
idk, I can't share the results, but I just waited for this for over 30 minutes. i have 16GB of Memory, available 9GB
i tried to disable other extensions, but still slow even i just enable prettier plugin, i hope dev, have solution of this problem

finnaly this is the output

I thought I was the only one but I think the recent version is causing the same issues for me
same issue for me after updated macOS to 13.3 and updated vs code to the last version
same issue, after updating plugin to 9.12. macOS 13.2.1, VS Code 1.77.3
Same problem here. Windows 11, using WSL2, and macOS 13.2.1. Latest VSCode
Debug logs don't show errors:
["INFO" - 3:10:57 PM] Formatting file:///home/valentin/[redacted]/src/components/[redacted].astro
["INFO" - 3:10:58 PM] Using config file at '/home/valentin/[redacted]/.prettierrc'
["DEBUG" - 3:10:58 PM] Local prettier module path: '/home/valentin/[redacted]/node_modules/prettier/index.js'
["INFO" - 3:10:58 PM] Using ignore file (if present) at /home/valentin/[redacted]/.prettierignore
["INFO" - 3:10:58 PM] File Info:
{
"ignored": false,
"inferredParser": "astro"
}
["INFO" - 3:10:58 PM] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 3:10:58 PM] Prettier Options:
{
"filepath": "/home/valentin/[redacted].astro",
"parser": "astro",
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 120,
"pluginSearchDirs": [
"/home/valentin/[redacted]"
],
"semi": false
}
["INFO" - 3:10:58 PM] Formatting completed in 1326ms.
The first line in the logs takes a long time to arrive after hitting the save button.
Sometimes, there is a long waiting time after the first line, and then the extension crashes.

A little bissect shows prettier is the culprit:

Same issue here. Mac. i went back one version and it worked great for 1 day now is back slow. just verified still back one version.
This is a MUST fix.
Same issue here. Mac. i went back one version and it worked great for 1 day now is back slow. just verified still back one version.
This is a MUST fix.
I just set the Default Formatter for the Workspace to prettier. I had it set for the user but the workspace was still unset. It seems to be working again.
TLDR Set the default formatter in BOTH workspace and user settings.
UPDATE: It's back .... Going to have to uninstall this.
I unchecked these options and the problem was solved for me!
Same issue.
Same issue here. I'm 🤏 this close to uninstalling cause it's unbearable.
I got this problem right after adding Jest tests to my NextJs project. Before that it was running and saving files with no issues. Now, the Prettier runs forever and I can't safe my changes unless I press cancel.
I had the same problem on a few other projects but this time I noticed that it might be related to tests.
Please help!
I unchecked these options and the problem was solved for me!
@ameer-taghavi doesn't work for me. Still having the issue with those settings disabled.
~Reverting to v9.10.4 appears to be working for me.~
Edit No it does not.
After trying many of the possible fixes listed in this thread and others in this repo I still ran into this issue. Even after disabling the Prettier extension I ran into the same issues with VS Code's TypeScript formatter.
Eventually I found an issue in the VS Code repo which reported the same issues. I'm happy to report after downgrading to version 1.76.2 and using VS Code heavily for the past 2 days I'm not longer seeing issues with Prettier formatting taking forever to load.
Instructions on how to downgrade and prevent automatic updates from wiping out those changes can be found here.
Is there an ETA on when this will be fixed? This is a pretty breaking bug that I'm surprised doesn't have a higher visibility
If you are using Auto Import - ES6, TS, JSX, TSX extension, try to uninstall it and replace it with Auto Import.
https://github.com/prettier/prettier-vscode/issues/1333#issuecomment-905404600
After trying many of the possible fixes listed in this thread and others in this repo I still ran into this issue. Even after disabling the Prettier extension I ran into the same issues with VS Code's TypeScript formatter.
Eventually I found an issue in the VS Code repo which reported the same issues. I'm happy to report after downgrading to version 1.76.2 and using VS Code heavily for the past 2 days I'm not longer seeing issues with Prettier formatting taking forever to load.
Instructions on how to downgrade and prevent automatic updates from wiping out those changes can be found here.
For now, this is what worked for me as well!
After trying many of the possible fixes listed in this thread and others in this repo I still ran into this issue. Even after disabling the Prettier extension I ran into the same issues with VS Code's TypeScript formatter.
Eventually I found an issue in the VS Code repo which reported the same issues. I'm happy to report after downgrading to version 1.76.2 and using VS Code heavily for the past 2 days I'm not longer seeing issues with Prettier formatting taking forever to load.
Instructions on how to downgrade and prevent automatic updates from wiping out those changes can be found here.
This worked for me 👍
The same issue. I do not have installed Auth import plugin. The problem appeared when I updated VS Code to the version above 1.76.2. Fixing VS Code version on 1.76.2 fixes the problem.
I am facing the same issue, I am on the Insiders build even.
I never found it after looking and trying things for days. i have since went back to 1.76.2 per @WagnerMoreira above and have not had the issue since. Just waiting on someone to say they found the root cause before upgrading.
Running into this issue as well. :(
I downgraded to 1.76 and the issues went away.
So? The "fix" is downgrade to 1.76?
Yes because it looks like no one uses it on a large repo with normal web dev tools, to notice the latest to be slow and they probably dont use Copilot either. Its hard to replicate for anyone, unless they really dont ever work on "real world projects". Its hard to tell, why the whole world isnt screaming "wtf". by the whole world I mean the core maintainers of vscode, prettier, or other plugins like eslint that all have been screwed by Microsofts changes.
Its quite simple to replicate, I can replicate it anytime. If anyone wants to do a Video Conference, let me know.
So? The "fix" is downgrade to 1.76?
Didnt work for me, i just use Rome for now... tried all the solutions i could find, still waiting 13-40 seconds for a file to save... if i do 2 saves or cancel the save then it pushes the changes and saves the file without the formatting and sometimes a third save after that is a quick 13ms~ save. so either CTRL+S twice or cancel the save and save again or use something else like Rome.
Is this the related issue, finally someone caught it? We should be able to see if it solves it in the next minor releases, perhaps insiders... https://github.com/microsoft/vscode/issues/184926
in my case, the problem is prettier-plugin-tailwindcss, i try remove this package, idk but all back to normal without automatically sorting class