Use Ctr-Enter to execute instuction where the cursor is.
Currently, is kind of tedius to execute a targeted line. Other editors accept Ctl-Enter to execute the line, which is very convenient.
-
Zsolt commented
The currently assigned hotkey is part of the tool tip as shown on the attached screenshot.
I think that would help if the button on the toolbar would have a shortcut assigned by default or if those other two buttons would be displayed in place of the current "play" button.
Having both buttons on the toolbar would be more educational / self explanatory.
-
Zsolt commented
Thanks for clarifying, looks like its just hard to find this VSCode option for new comers.
-
AdminMassimiliano (Admin, MongoDB) commented
Admittedly, we currently don't have a shortcut to run the current line.
We do, however, have shortcuts to run the whole playground (Ctrl + Alt + R on Win/Linux and Cmd + Option + R on macOS) or the current selection (Ctrl + Alt + R on Win/Linux and Cmd + Option + S on macOS).
Shortcuts are also customizable from VS Code's global shortcuts config screen. Just search for MongoDB.
-
Zsolt commented
Also, 2 birds with one stone, there can be another key combination [ Ctrl + \ ] for executing the query with separate results window.
Both of these should perform batch execution when there is a selection in the editor marking the batch to execute. Otherwise, just execute the statement / query under the cursor.