rory.ap
rory.ap

Reputation: 35318

How to use mouse to run to cursor or set next statement in VS Code

In Visual Studio, it's really fast and easy to move the debugger somewhere with the mouse by hovering next to the line and clicking the icon that appears:

enter image description here

Similarly, you can move the debugger back to a previous statement by holding the Ctrl key down while hovering:

enter image description here

How do I access this behavior in VS Code? The only options I can see are to right-click and select from the context menu, or use Ctrl + Shift + P to search for the command, as described in this video. Both these options are tedious compared to the inline mouse click.

Upvotes: 0

Views: 1774

Answers (1)

starball
starball

Reputation: 52225

There should be an action item for this in the context menu (right click menu) of the editor when you are in a debug session context. "Run to Cursor".

There's also "Jump to Cursor" (see How to use the "jump to cursor" debugger command when debugging Python in Visual Studio Code).

Note that you can also bind the command to a keyboard shortcut. The command ID to use in your keybindings.json is editor.debug.action.runToCursor.

If you want something just like you've shown in your screenshot- a button in the gutter, you can either look for or write an extension that adds such a button, or create a feature-request asking for such a feature. I tried googling to see if a feature-request for such a feature had already been raised by googling "site:github.com/microsoft/vscode/issues "run to cursor" button" but didn't find an existing one (all I found was a loosely related one: Add 'Run to cursor' to VS Code debug floating bar #116250).

Upvotes: 0

Related Questions