yoavbls / pretty-ts-errors

🔵 Make TypeScript errors prettier and human-readable in VSCode 🎀
https://marketplace.visualstudio.com/items?itemName=yoavbls.pretty-ts-errors
MIT License
13.14k stars 89 forks source link

Saving a file is hanging indefinitely #88

Open lildesert opened 8 months ago

lildesert commented 8 months ago

Describe the bug Hi, since today this extension has been causing the save file action to hang indefinitely. I deactivated all my VSCode extensions and this one seems to cause the issue. I don't have any more insight but I'll be happy to send more if someone provides guidance.

I use the v0.5.2 and also tried the v0.5.1 which causes the same issue.

Here's my VSCode info:

Version: 1.84.2 Commit: 1a5daa3a0231a0fbba4f14db7ec463cf99d7768e Date: 2023-11-09T10:52:57.054Z (1 wk ago) Electron: 25.9.2 ElectronBuildId: 24603566 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Darwin arm64 21.5.0

Expected behavior Saving a file should be instant.

Screenshots

image
summaarum commented 7 months ago

Having the same issue. Used the VS Code extension bisect tool and in fact it seems to be this extension.

Screenshot 2023-12-10 at 11 29 29

To me it seems to happen when working with code where the TS errors are super long. I've solved it for now with setting "noErrorTruncation": false,. It's not ideal but it seems to work.

yoavbls commented 4 months ago

It is weird because the extension does not interfere saving of files, Does someone see some behavior that could cause that? maybe something that we're not doing correctly in the extension?

I also failed to reproduce it, so it would be great if someone could help with that.

kevinramharak commented 3 months ago

I attempted to reproduce by checking out the typescript and vuejs/core repositories. As both are pretty large and vuejs/core is a monorepo. I cannot reproduce any problems with the extensions. Running the extension host profile does not show any performance issues with the extension.

So far it seems this issue and #102 seem to use a macbook, I use a windows machine. Doubt its related but if more people raise issues it could be worth asking.

To me it seems to happen when working with code where the TS errors are super long. I've solved it for now with setting "noErrorTruncation": false,. It's not ideal but it seems to work.

This seems interesting to me. Maybe it has to do with truncated errors? Something like a recursion with regular expressions? It all seems to be handled here: https://github.com/yoavbls/pretty-ts-errors/blob/2531440478077fd3f3335e3e3d1b92c9679eb1bc/src/format/formatTypeBlock.ts#L54-L76

I don't see any reason for the extension to stall in a seemingly infinite loop.

ChristopherHaws commented 2 months ago

Just an FYI, I run Windows, Linux, and macOS and it happens on all three for me, so it doesn't seem to be platform specific. I see this issue most often when moving a typescript file which triggers vscode to update the import paths in any file referencing the moved file.

kevinramharak commented 2 months ago

@ChristopherHaws Thanks for the addition, that is helpful. I'm gonna see if I can reproduce it by moving a file causing TS to update the imports.