Comments (7)
No, I have no idea. While the plugin loads a generated parser, it’s not really memory-hungry. However, I’ve only tested it in Node, not in a browser.
Can you look at memory usage, see what kind of limit it hits? How did you get that stacktrace? What is the code running in? Did you really get Chrome to crash or that’s some sort of Electron environment?
from prettier-plugin-csharp.
It is a react application (create-react-app template). It uses webpack as a dev server and as the build tool.
This is the react app: https://github.com/jannikbuschke/csharp-script-runtime-and-editor/tree/master/app/web
In this file Im trying to format code with prettier/your plugin; https://github.com/jannikbuschke/csharp-script-runtime-and-editor/blob/master/app/web/src/scripts/execute-script.tsx
The stack trace is printed to the console when trying to start the react application in debug mode via npm run start
.
Not sure how to pinpoint this kind of stuff.
from prettier-plugin-csharp.
I tested locally your project and was able to reproduce the issue. The crash occurs during compilation when including Prettier. Node process memory usage reaches 1.5 GB, whether you include the plugin or not (just call prettier.format(...)
without the plugin options). I think it would be better to report this problem to the Prettier project instead of the plugin.
Still, I'm curious so I investigated. Raising the Node heap size is enough to fix the problem. See npm/npm#12238 (comment). Problem fixed in my environment: memory usage tops 2 GB and compilation succeeds.
I'm going to close the issue. Don't hesitate to re-open if you think the problem is related to the plugin.
Cool project by the way. Keep me updated if you manage to use prettier-plugin-csharp
!
from prettier-plugin-csharp.
@warrenseine thanks for looking into this.
I created another repo https://github.com/jannikbuschke/-prettier-standalone-custom-parser to pinpoint the issue further.
One thing that I did wrong was to use the whole "prettier" package, whereas it should be "prettier/standalone".
In the new repo I use prettier/standalone with your plugin as well as with a graphql plugin. The graphql plugin works in both cases. The memory issue comes up only if the prettier-plugin-csharp is imported. Thats why I assume it has something to do with the build system and your plugin.
I created an issue in the prettier repo, but Im not sure where this really belongs to.
from prettier-plugin-csharp.
Tested again, and both projects on your new repository compile and run fine here.
from prettier-plugin-csharp.
Are you using node v12? I used v10 and now tested with v12 and it seems to work without changing the memory limit (--max_old_space_size=4096
). I think this is because v12 allows more memory out of the box.
from prettier-plugin-csharp.
Indeed.
from prettier-plugin-csharp.
Related Issues (20)
- How to install and use as plugin in VSCode? HOT 2
- Rename project? HOT 1
- Sorting 'System' first is deprecated HOT 2
- Support for C# 7 local functions HOT 2
- String interpolation handled incorrectly HOT 1
- Can I run this directly from Visual Studio? Are there plans for an extension? HOT 3
- Are you accepting contributors? HOT 2
- Bug: Embedded Empty Statements are deleted HOT 2
- Mixed tabs & spaces HOT 1
- Comments inside empty class definitions don't get printed HOT 1
- Empty braces are not consistently formatted HOT 2
- How to install - doesn't seem to work HOT 2
- question: support for different csharp versions HOT 3
- Inconsistent #if ... #endif blocks reformatting HOT 2
- Activity HOT 2
- Unable to run HOT 1
- Using formatting HOT 5
- no viable alternative at input 'default;' HOT 1
- What is the current status on this plugin? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettier-plugin-csharp.