I am making a project in python in VS Code and am testing some code however due to code before it takes a large amount of time to reach the part I am testing, is there a way to get directly too it by setting a form of start point, where the code will run from? Thanks.
I have tried to find an extension/ plug in to do this to no luck. If you know of one that would allow me to do this or if it already a feature on VS Code that would be much appreciated.
2
Answers
You can try using Jupyter Notebook, which separates your code into code cells, and you can split your code in any way you want.
This means that you can place the codes above your starting point in a code cell and run it, so that the remaining code can be run at any time.
An IDE or debugger program (in most cases and for most languages) does not control where your program starts running. Your program does. To change where your program "starts running", you must change your program to put what you want it to do first at the beginning. If it takes a while to get to the code of interest, then the question is whether you can skip running any of that earlier code to get to what you’re interested in. If the state of the program of interest depends on some other code to run first, that code obviously cannot be skipped.
If you actually want to control where it stops first after starting, then what you want is a breakpoint, in which case see Add breakpoint in Visual Studio Code.