nova-rust icon indicating copy to clipboard operation
nova-rust copied to clipboard

Mark an issue on failed formatting instead of only logging to console

Open laralove143 opened this issue 4 years ago • 2 comments

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:

  1. check console
  2. see where it failed to format in the logs
  3. manually navigate there and fix it
  4. save so it’s formatted again
  5. repeat for every place that’s failed to format

laralove143 avatar Oct 02 '21 07:10 laralove143

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.

kilbd avatar Oct 10 '21 13:10 kilbd

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

laralove143 avatar Apr 16 '22 21:04 laralove143