Closed tjayrush closed 3 years ago
Same there. Not sure what exactly causes that... but in my case it happens when i: 1) First modify an SVG XML inside of tagged template literals like:
export const ChevronRight = (): SVGTemplateResult => svg'
<svg id="i-chevron-right" viewBox="0 0 32 32">
<path d="M12 30 L24 16 12 2" />
</svg>
'
2) And then trying to save some other file.ts
typescript file which imports that SVG object.
Prettier hangs up exactly when saving file.ts
.
If i press Cancel then i get this on next save:
Only Reload Window helps, but it's annoying as hell as i should start dev server all the time. I tried to use (enable/disable/uninstall) several tagged template literal plugins - the result is same. Prettier always gets on my way.
More over - i have no any hints (which plugin or other info) from Prettier itself, how could i debug that.
The issue you referenced was closed because I can’t reproduce the bug. If someone can provide a valid repro I’m happy to try to fix it, but that bug nor this one has enough info. This extension has millions of monthly users. Clearly not everyone is having this issue. Please provide repro step and I’ll investigate.
This same issue happens when I try to save .md files on VSCode sometimes. But when I cancel and resave the file, it works.
I'm having the same issue as well and have been for a while now. It's a private repo with an NDA type of situation so I can't really share that. I don't know what this could be.
Same Issue here
I was never able to solve this issue and I spent countless hours debugging it over the course of two very frustrating months that it was happening. I eventually realized that I was wasting an absurd amount of time on this one problem and I uninstalled every version of VS Code that I had on my computer. I deleted all the temporary files, cleared the caches, started with a fresh install and reinstalled all of my extensions once again.
When I tried to back everything up before taking the nuclear option, the problem just persisted so I realize I had to wipe everything out if I was going to truly fix this.
Once I started reinstalling extensions, it became apparent that I have really customized my editor to my liking over the past several months and I thought that I would be able to remember all of the settings that I was using but I couldn't even come close. I ended up having to play with a lot of settings and extensions to get everything to feel normal for me again since I work largely with VueJS.
Now I don't have the issue anymore but I was never able to get to the bottom of it and I tried hard.
It's the worst kind of bug because you don't get any logs to reference regarding what's happening behind the scenes, other people can't reproduce it because I think it has something to do with your settings (ESLint, Prettier, Vetur, etc...)
Save yourself the headache and just make note of the important settings. Go for a fresh install and try to make sure that you don't have too many things which could effect formatting.
That's the best solution I could find even after consulting associates and friends for help. Everyone was stumped.
I agree with @716green , but the truth is that I have done a clean installation and it continues to happen, with only the Prettier extension.
@ntotten I'm able to mostly consistently repro this,
git clone https://github.com/Automattic/wp-calypso.git
I'm not sure where the failure is really happening, probably on the first save after line delete and then isn't recovering on the second.
This problem happens both with the prettier plugin or the eslint vscode plugin (because we use the prettier plugin for eslint.)
The only way I've found to recover from this state is to sigterm the electron thread at 100% load or to restart vscode (at which point, with the replaced fragment close, will continue to format correctly)
I suspect this is hard to repro because it probably has more to do with the large number of cascading errors that stems from removing one fragment closure line than removal of the line itself. You probably also need a significantly complicated enough file to trigger the failure mode.
I have been seeing this over the past couple of days. It has been very frequent and happens even for files that have had a 1 line change.
seeing it as well. for filesizes as small as 66 lines, probably less too.
@lsl Thanks for the repo, i will investigate when time allows.
Seeing this issue also.
I observe a few minutes of waiting...
Same issue here.
Same issue here
☝️
Had the same problem and solved it by cleaning up my settings.json
Same issue here
same issue
same here
I experienced this last week on a Typescript React project, however, I also got this problem while working on a Go project just now. Code action on Save took a while and failed to auto format and auto import packages. This is probably an issue with VS Code itself and not the VS Code prettier plugin.
I was working in a Workspace with multiple folder paths (3). 2 of which were Go projects and the third being a general data folder which has one html
file in it. My workspaces are pretty much Go files though.
Same.
same
same
I'm experiencing this now. I spent about an hour diagnosing it. The issue, in my project, seems related to running typescript w/ nextjs. Perhaps open files, file locks. Not sure.
To reproduce the issue, I ran yarn next
to start nextjs project in dev mode; browse a page; and then edit/save the page. The lengthy save dialog happens after a few tries. The dialog remains open for about 45 seconds. I noticed that tsconfig.json didn't exclude .next
folder which is where nextjs caches files. Once that folder was excluded from typescript's config and after restarting VSCode and nextjs, saving files is under 100ms again. Keeping my finger crossed.
To be clear, this is what I changed
// tsconfig.json
{
"compilerOptions": { ... },
// edited this
"exclude": ["node_modules", ".next"]
}
Update: The steps above provided temporarily relief. Increasing system parameters seems to be a better win. I'm on Linux.
@mgutz I think this might have to do something with having large files open in VSCODE. Whenever I open a compiled version of main js file from Webpack I start to have these issues and its been pretty consistent to the point where I now start to look for the large file that is open a tab somewhere.
Running into this issue now in all JS and SCSS files. The most recent SCSS file this was happening to is 67 lines long. The JS file is 233 lines. Not convinced it's related to file size. Have not had this issue until today. Just started about 2 hours ago and is occurring randomly. Restarting VS Code fixed it for now.
@pixelprogrammer My project is a new nextjs project. The file I'm diagnosing is only 60 lines. I'm starting to think this is VSCode itself, maybe the language services. If I disable pretttier and switch to VSCode's built-in typescript/javscript formatter, I also see the delays. I remember the Go extension having similar issues some time back and all paths were leading to gopls language server, though it was never resolved conclusively.
Same problem here with a next.js project and very small files. Saving takes forever. Reload window in vsc solves the problem temporarily.
Same problem. Mine is on a fairly fresh create-react-app install with a couple of folders with 1 or 2 JS files. The only thing different about this project is that there is a large JSON file in one of the src folders but that shouldn't do this.
Same issue here. After several minutes it starts failing. Restarting VSCode usually fixes it...
Having this issue, I'd love to disable the extension for this file, but leaving // prettier-ignore
doesn't skip formatting. Even after choosing "cancel", I have to restart vscode entirely in order to continue working.
I recently reset my laptop to factory settings and moved almost all of the files and folders on the hard drive to an external drive or the cloud. For me, this solved all of the issues I was having with VS Code. Not sure if it's because Prettier was maybe taking a ton of virtual memory on the HD that wasn't available or if I fixed the problem by reinstalling VS Code. Either way- at least it worked for me.
On Tue, Feb 16, 2021 at 7:30 PM Ben Mitchinson notifications@github.com wrote:
Having this issue, I'd love to disable the extension for this file, but leaving // prettier-ignore doesn't skip formatting. Even after choosing "cancel", I have to restart vscode entirely in order to continue working.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/prettier/prettier-vscode/issues/1333#issuecomment-780207205, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEM4YU4FZXMGV6YE3ZW22XTS7MEZPANCNFSM4MJTBD3Q .
I am also facing the issue , Its taking a long time to save. I have noticed one thing it only happens when we used to do work for long time with the large files. Once you close the VSCODE and reopen, it works perfectly again...
So is there some cache problem ???? Any idea ??
This usually happens when there is long compressed/minified file and VSCode throws:
Tokenization is skipped for long lines for performance reasons.
After that Prettier freeze.
Changing editor.maxTokenizationLineLength
to higher value doesn't help.
Please try out the preview release of the Prettier extension. There have been a number of performance changes that I believe should help with this. https://github.com/prettier/prettier-vscode/wiki/Testing-Preview-Releases
I don't want to release this to the main channel until we get a decent amount of testers to try it out because the changes are significant. Please report any bugs and let me know if you see performance improvements.
@ntotten Is there particular stuff that We should watch that can break/bug?
I have never been able to reproduce this and the way registration works in 6.0 has changed a lot. I think it should fix the problem. If not somebody needs to provide me with a way to reproduce this problem consistently.
@ntotten I'm still having this issue saving on every file unless it's in the .prettierignore list.
The beta version you mentioned seems to no longer be available?
Does that mean the performance improvements are supposed to have made it into the latest version?
I'm on 6.3.1 and still severely having this issue.
I always thought it was my "old" 2016 MacBook pro that was the cause. But I just upgraded to a new M1 and it still gets stuck on save with prettier.
The changes in beta are now in the regular extension. If you can provide me a way to repro the issue, I'm happy to investigate, otherwise I'm not sure what I can do when I can't reproduce the issue.
I can't provide repro, but I have sporadically seen this few months now:
(This just happened with 6.3.1 btw, so it is still broken somehow.)
There are multiple same issues here #1342 and https://github.com/microsoft/vscode/issues/105026
I wonder how is the best way to debug this, it doesn't happen all the time, it just suddenly does that and then it's really stuck until I reload the whole VSCode.
Understandably I'm not expecting anyone to fix this soon, because we don't know how to reliably repro this.
Having the same issue. Even weirder, is that I've added css
files to the prettierignore
file and it still insists on formatting CSS, get stuck, then I have to quit VSCode. 🤮
Same issue. Restarting VSCode is the only way to fix it for me...
same issue
I'm sick of revisiting this thread every few months to see if anyone has found a solution. What will it take to get the right people to look at this for us? It's clearly an ongoing problem. It would help if there was an easy way to debug or get a list of everything that is being scrubbed by prettier so we can manually test things.
after months I'm still having this issue as well.
Restarting VS-code solves it temporarily, but then it starts happening again a short period later. I even tried removing all plugins I just absolutely can't live without and it's still happening. (none of the other plugins messes with saving or formatting)
This issue needs to be re-opened. It's clearly still an ongoing issue.
Somebody solve this? It's driving me crazy 😵
Same issue...
Same issue.
How to reproduce this? Just compress or minify long JSON or CSS and open that file again. There is no need for whole repository.
Or just open one minified/compressed js file from some library.
Not to mention that beta version totally freezed my VSCode sync between devices as its not possible to download beta anymore.
I have encountered this several times, and it's not clear to me exactly what causes it. Sometimes restarting VS Code fixes it, and other times it doesn't. Happens with a variety of file types. Would love to see a solution to this.
Summary
Frequently, when I save a file with FormatOnSave option on, it takes forever to finish saving. I have to quit VS Code and restart. Then, save happens instantaneously again. After a while, the issue re-appears. The identical issue to this one: https://github.com/prettier/prettier-vscode/issues/1253. Not at all clear why that issue is closed -- clearly people are having this problem.
Github Repository to Reproduce Issue
https://github.com/prettier/prettier-vscode/issues/1253
Steps To Reproduce:
https://github.com/prettier/prettier-vscode/issues/1253
Expected result
Doesn't take a long time to save.
Actual result
Took forever to save.
Additional information
Obviously, many people are having this same problem. This issue (https://github.com/prettier/prettier-vscode/issues/1253) should not be closed.
VS Code Version:
Prettier Extension Version:
OS and version:
Prettier Log Output