Bear with me, I am an avid Matlab user - debugging here is very convenient: it is flexible, easy to use and fast. Coming from this, I struggle with using the basic debugging provided by Visual Studio Code (when using Python).
My basic code generation routine involves using breakpoints for the generation of new code. That is, I set a breakpoint at where I want to insert new code, then run my code up to the breakpoint and upon stopping at the breakpoint, I extend the code with the desired functionality, using the debug console to move through functions, checking the respective workspace and finally and importantly to check if the logics of my new code are right. This has always worked very well in Matlab, but does not in VS Code.
I use VS Code 1.73.1 (newest as of todays writing) and Python 3. I imagine my problem is more of a VS Code issue than related to Python, i.e. language agnostic.
Questions:
Doing what is described above in VS Code, I randomly receive a debugger notice "Timeout waiting for debuggee to spawn". Sometimes, this disappears when running the debugging button, sometimes it does not. It often appears repeatedly, and sometimes resolves after hitting the "Debug Python Code for the n-th time. Then I can debug my code for a few times without that notice until it appears again. It appears out of the blue and is highly annoying. What can I do about it? Should I need to configure anything in a launch.json, I'd need a complete and self-containing description of what (and ideally why) to do as I am really new to this way of engineering software.
The debugger is incredibly slow to reach the first debugging points. In Matlab, I reach my debugging points "immediately" after hitting "run/debug code" - in VS Code, this may take up to a minute. What can be done about this? It makes my code generation routine described above infeasible, as I frequently repeat that routine while iterating the code's design. It also leads me to the next question.
What are your thoughts on the above approach, given the VS Code and Python context? How to do better without configuring break point options? I just want a simple standard debugging configuration setting breakpoints and then clicking "Debug Python File".
What I did:
Restart VS Code, switch between "Run Python File" and "Debug Python File", randomly configure a launch.json file based on what I read (but likely did not fully understand) on internet fora.