January 8, 2021, 6:41am
I installed email@example.com.
Syntax highlighting and error alerts are working, but the code formatting is not working.
How can I fix this?
In this sample snippet, I am expecting 3rd line to start from the beginning after the file is saved in vscode. But it is not happening.
I’m not sure why it’s not working for you, but I have
1.0.4 installed and it seems to be OK for me. I can adjust this code and it always formats back to this:
Also, for me, the semicolons are also being automatically removed
Do you see the
ReScript language mode in the bottom right corner?
January 8, 2021, 7:37am
silly question: did you
npm install your project dependencies?
January 9, 2021, 11:00am
Yes, I did.
rescript & react app demo I am building is working fine, but the formatting is not working in vscode.
January 9, 2021, 11:02am
Yes, I see Rescript language mode in the bottom right corner.
January 9, 2021, 11:07am
I found out that the issue is in my vscode settings
I had this in my settings which is causing the problem.
I removed it and rescript formatting is working fine.
Thanks for the help.
April 18, 2022, 9:16pm
Yep, this was my problem as well. Thanks
Just for thread completeness, you can have language-specific configurations inside settings.json, so there is no need to remove prettier completely:
Something like this should work.
April 19, 2022, 10:54am
@mxthevs. Also, the last thing for the completeness is that I discovered
formatter has 0 configuration options, typically nice but this formater has a bug core team wont fix with line width, especially bad when using pipes.
I’m playing with Rescript for some time now, and I have to say I really don’t like how Rescript format a code by default.
The most common things are:
enforcing pipe operators chain in one line
enforcing component props in one line
Is it possible to apply a custom format style?