5

Python debugger supports the jump command to set the next line to be executed.

Can I use this feature when debugging Python code in VS Code?

7
  • Do you mean "Step Over"? If so then it's supported. Commented Nov 19, 2018 at 20:39
  • I mean jumping back (or forward) to a given line number. This is supported by the debugger - see the docs. Commented Nov 20, 2018 at 10:30
  • I basically want to be able to modify code and reevaluate it without restarting the program, just like it's done in Visual Studio 2017 with C#. Commented Nov 20, 2018 at 12:56
  • The extension does not use pdb but ptvsd; different debugger. As for changing values, you can do that from the debug console. Commented Nov 20, 2018 at 20:36
  • 1
    In Visual Studio you can change/add/remove instructions, jump back and forth, etc. without restarting the program. That's what I'm asking for in VS Code. Any idea where I can request this feature? Commented Nov 23, 2018 at 11:50

2 Answers 2

4

v1.36 of vscode has added this "jump to cursor" functionality, see debug: jump to cursor in release notes.

Jump to cursor

We have added a new debug command Jump to Cursor, which lets you move program execution to a new location without executing any of the code in between. If Jump to Cursor is supported by a debugger, the new command appears in the editor context menu and Command Palette while debugging. Currently this command is only available from the C# extension, but other debug extensions should follow soon.

Now the Python debugger must add the feature.

And there will be a Command Palette alias Set Next Statement added soon, see https://github.com/microsoft/vscode/commit/fb28cedc37fcdd589f6a7d35ef093f324d649a3c (Introduce "Set Next Statement" as an alias for Jump to Cursor).

Sign up to request clarification or add additional context in comments.

1 Comment

Right to June 2020 (version 1.47) "Jump to Cursor" changed to "Set Next Statement". But AFAIK, it supports only C# (nor C, nor Python)
1

This feature has now been added to vs code for python, open the command palette (Ctrl + Shift + P) and search for Jump to Cursor.

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.