gleam-lang / playground

18 stars 3 forks source link

Format button #3

Open isaacharrisholt opened 4 months ago

isaacharrisholt commented 4 months ago

Add an autoformat button that takes the user's code and formats it.

Note: due to potential large binary sizes, we should test:

lpil commented 3 months ago

This is not something we have a wasm API for yet. One thing I would like to do is to ensure that it does not cause the wasm binary size to grow too much.

isaacharrisholt commented 3 months ago

Could we use a separate binary that can be downloaded later? So it's opt-in, or perhaps it can even be streamed in, i.e. some sort of 'download formatter' button that gets the formatter. We could generate a hash of the binary at build time that the playground could check against the cached version to see if it's been updated since the last download and prompt the user accordingly

lpil commented 3 months ago

I suspect that would be a second large binary, but I could be wrong.

isaacharrisholt commented 3 months ago

Sure, but if it's optional, I think that negates the issue slightly. I think the best thing to do would be to test these things. I'll add a task to the issue

lpil commented 3 months ago

A second equally large binary would be worse than one slightly larger binary for me. I would like to have this with only a small increase in download size.

isaacharrisholt commented 3 months ago

Fair. Needs more research, and I think #2 is probably higher priority anyway