Mark an issue on failed formatting instead of only logging to console
rustfmt already tells where it failed to format (strings etc) we could make nova parse that as an info or warn level issue. would make it much better ux. right now they’d have to:
- check console
- see where it failed to format in the logs
- manually navigate there and fix it
- save so it’s formatted again
- repeat for every place that’s failed to format
I finally had time to play with some Rust code, and I think you're right that Issues are the best way to alert users that there was a formatting error. I'll have to see if I can make this happen, but there are a few challenges:
- Errors aren't in JSON format, so I'd need to parse messages myself, which is more prone to errors
- Messages are spread across multiple lines, so an additional parsing challenge is grouping together lines for the same error
- The error message has the start of the range for the line, and I'd need to calculate the end of the range
This seems very doable, but could take some time to get it right.
i think there's other issues with higher priority, we might turn back once they're done though! also i think rustfmt nightly has a json output option, if not, it shouldn't be that hard to parse manually