FuelLabs / sway

🌴 Empowering everyone to build reliable and efficient smart contracts.
https://docs.fuel.network/docs/sway/
Apache License 2.0
62.79k stars 5.35k forks source link

Support formatting for invalid sway code #5012

Open sdankel opened 1 year ago

sdankel commented 1 year ago

Currently, if the code fails to build, the formatter will do nothing. Ideally, the formatter would still do basic formatting even when the code doesn't compile. For example, when there is a misspelled variable name but everything else is correct, it should still be able to format the document.

Here are the cases when cargo fmt does not run: https://github.com/rust-lang/rustfmt#limitations

We should aim for this as well.

eureka-cpu commented 12 months ago

Is this still open?

xunilrj commented 10 months ago

I think this is already supported. See https://github.com/FuelLabs/sway/issues/4911. But this needs to dealt on a case-by-case basis.

sdankel commented 9 months ago

It's still not yet supported in the formatter, but it sounds like it's not blocked.