golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.72k stars 17.62k forks source link

x/playground: consider alternative keyboard shortcut for "Run this code" #58892

Open Deleplace opened 1 year ago

Deleplace commented 1 year ago

What version of Go are you using (go version)?

go1.20.1

(in the playground actually, not my computer)

Popular playgrounds' key bindings for "Run"

Playground   macOS Linux Windows
Go https://go.dev/play/ Shift-Enter Shift-Enter Shift-Enter
Rust https://play.rust-lang.org/ Cmd-Enter OR Ctrl-Enter Ctrl-Enter Ctrl-Enter
Dart https://dartpad.dev/ Cmd-Enter OR Ctrl-Enter Ctrl-Enter Ctrl-Enter
Kotlin https://play.kotlinlang.org/ Ctrl-R Ctrl-F9 Ctrl-F9
Sharplab https://sharplab.io/ autoplay autoplay  autoplay
Wandbox https://wandbox.org/ Ctrl-Enter Ctrl-Enter Ctrl-Enter
Colab https://colab.google/ Cmd-Enter OR Ctrl-Enter Ctrl-Enter Ctrl-Enter
BigQuery https://console.cloud.google.com/bigquery Cmd-Enter Ctrl-Enter Ctrl-Enter

In general

It would be nice to reach convergence among different playgrounds for this specific standard feature, for the same reasons that it's nice to have (often) the same shortcut for Copy & Paste

Suggestion for Go's playground

Add Ctrl-Enter (Linux, Windows) / Cmd-Enter (macOS) as bindings for "Run this code".

This seems to be more widespread and more intuitive than the current binding Shift-Enter.

This can be done while keeping the existing binding Shift-Enter.

This does conflict on Linux with the current binding for "Format this code", so we'd need to decide if changing things for "Format this code" is acceptable damage.

cagedmantis commented 1 year ago

/cc @toothrot @findleyr