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

Configuration option to "format on save"

Open ian-h-chamberlain opened this issue 2 years ago • 0 comments

Similar in spirit to #844 , it could be nice to have automatic formatting whenever the code is "submitted" (i.e. Run / Test / Build etc.), although I think this should probably be configurable in user settings.

One thing that might be tricky is order of operations — The current rustfmt implementation seems to minimize its output after running, which would be fine so long as the subsequent "Run" command showed the output again. If they were run in parallel this might be hard to synchronize, but if Format always ran prior to Run perhaps it wouldn't be an issue.

Possible UI mockup (probably default to DISABLED, to avoid changing behavior from existing):

Screen Shot 2023-10-21 at 9 54 02 AM

Examples in other tools:

  • https://go.dev/play/ (not my favorite playground, but I do like this particular feature)
  • https://goplay.tools/

ian-h-chamberlain avatar Oct 21 '23 13:10 ian-h-chamberlain