rust-playground
rust-playground copied to clipboard
Add the ability to reset the editor buffer back to the original "hello world" state.
Hi,
The rust playground remembers the last buffer you were working on. That's very useful, but sometimes I want to start afresh. I can't see a way to do this currently. Could there be a "clear" button which resets the buffer back to the default "hello world"?
Thanks
I think this is something that can be done. A super hacky way of doing this now would be to clear your browser state for the playground, but that clears everything.
If someone starts working on this, a semi-related request I've heard would be to have some "templates" of interesting pieces of code (e.g. a WASM hello world, or maybe a Futures example) to showcase pieces of the ecosystem. That's a bigger step, but might be worth keeping in the back of your mind.
to have some "templates" of interesting pieces of code
sounds good to me.
You could even go as far as a vim-tutor style experience for learning Rust interactively.
But perhaps you should raise a new issue for that.
Thanks
An extremely non-obvious thing you can do is to erase all the text and reload the page. This will reload the "hello world" example.
I just tested the suggestion above, and it doesn't seem to work any more -- reloading the page just reloads the empty text now. Having an explicit "reset" button would be great!
One potential enhancement: start tracking the last time someone visited. If they haven't visited in "long enough", then proactively offer to reset back to defaults.
I'm posting the default "Hello World" code here to make it easier for posterity to copy and paste it:
fn main() {
println!("Hello, world!");
}
I attempted to use the Playground via Chrome app on iOS. I basically failed for this reason - my browser had a large example and there’s no way to select all text for mass delete. Deleting character by character is very slow (and reverts to half speed if holding delete down, for unknown reasons). In the end I couldn’t find a way to reset the playground and had to give up.
Incidentally the “hold space to move cursor” technique doesn’t work either - something about the editor window is unfriendly to iOS.
For mobile users, I encourage using the simple editor:

Neither Ace nor Monaco work well in most mobile environments. The simple editor is just a browser-native text area.