RangeError: Maximum call stack size exceeded
See original GitHub issueHello there!
I recently switched from JavaScript to TypeScript. I always liked Prettier to keep a consistent code style. I found your extension very promising but I ran into an issue when using it.
I have several plugins and packages on my TypeScript project but after trying for a long time, I was able to reproduce it and it definitely is caused by your plugin since it works without it.
When I save a TS file in my larger TS project, it won’t be formatted at all. It seems like prettier crashes completely. I have a little exclamation mark in the task bar next to the prettier label and if I click on it, the following message appears:
["ERROR" - 7:38:37 PM] Error formatting document.
RangeError: Maximum call stack size exceeded
The whole log can is here: log.log
Although it says “Formatting completed” at the end, nothing happens. And this doesn’t happen without this plugin.
Versions: organize imports: v1.1.1 prettier: v2.2.1 VSCode: 1.52.1 OS: Windows 10 64 bit 2004 but my TS project is living in a WSL2 environment running on Ubuntu 20.04
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
It looks like I am not able to reproduce this behavior anymore. I reinstalled the plugin and tried running prettier from the command line like you said and it worked.
After that, I tried auto-formatting by saving again but it worked without any error. Really odd. I reinstalled my OS in the last few days because I had problems with the update and that seems to have fixed it for now.
I will reopen the issue if I am able to reproduce this again. Thanks for your help!
Ok I’m using similar versions (same prettier, same plugin, same typescript, and Node 15.3), and everything works fine for me (however I’m on macOS).
What you can try to do is invoke
prettier
from the command line in your project:If that runs into the same issue, then at least we know it’s not related to VS Code. In that case, can you also try to create a clean project and see whether it reproduces?