go-playground
go-playground copied to clipboard
Automatic save of code in localstorage
Hi Denis,
It would be nice if the code would be saved automatically, so that a refresh of the page / restart of the browser won't lose the changes.
I, for example, use Ctrl-W
in IntelliJ a lot, which would close the browser window.
I think that the local storage could be used, for example like in https://godbolt.org/
Issue can be of course closed if not in the scope of the project.
Best regards, Andrei
@DamianFekete it's considerable but I'm also looking for a contributor. If you feel that users might benefit for the issue - looking forward for contributions.
@DamianFekete I was thinking on some edge cases that need to be resolved to properly implement this:
- What is the best way to provide an option to "reset" the state of the editor. There is a context menu item right now, but not sure if it's clear enough.
- How multiple tabs case should be handled. Let's imagine I opened two separate tabs with different code and I touch both in interval of 5-10 mins. What tab should have priority?
Also, I was thinking about adding multiple files support per snippet (if it will be a popular idea), so solution need to consider that also.
Please share your thoughts.
@x1unix, thanks for your reply. All good questions and I don't think I have answers for them.
There is a context menu item right now, but not sure if it's clear enough.
I've just started using goplay and I didn't notice the down chevron until now. Maybe adding a label (like Templates? Examples?) would be helpful for others too.
Either that, or add a New... with a drop-down list to reset the current state to either an empty file or a template.
How multiple tabs case should be handled.
Maybe always displaying the information from the last tab active, with an option to see the history. This may involve too much work and at some point people may install a standalone editor/IDE.
Also, I was thinking about adding multiple files support per snippet
Will this be in different windows or in one window, the files being separated by something like --- file2.go
? I've seen this somewhere the past week, but I can't remember where.
I've just started using goplay and I didn't notice the down chevron until now. Maybe adding a label (like Templates? Examples?) would be helpful for others too.
Good point, I was also thinking about that but also was looking for other options because there are too many buttons already there.
Would like to hear a couple of good UI/UX ideas
Probably the whole menu should be re-organized.
Will this be in different windows or in one window, the files being separated by something like --- file2.go ? I've seen this somewhere the past week, but I can't remember where.
The original Go playground allows code splitting as separate files using special comment (something like ---
) but at the end it will be a long snippet separated by comment section.
This issue is stale because it has been open for 15 days with no activity. It will be closed if no further activity occurs. Thank you.
I also agree autosave option would be useful (unfortunately not DEV here, rather beginner). It happens so many times to me that I close browser and code is lost. Thank you for the great pkg anyway :+1: