Launch VSCode via PYTHONBREAKPOINT and Python 3.7's breakpoint() function. #1201
Replies: 6 comments
-
NOTE: this is important for codebases where each coder uses their own preferred editor, debugging tools, etc. Not just to avoid requiring use of VSCode, but to allow use of VSCode, where other editors / debuggers are normally used. It's a simple, but important standardised abstraction layer. |
Beta Was this translation helpful? Give feedback.
-
Well, I think that for this to work the ideal scenario would be to have a way to have the client (VSCode) already listening for connections, that way, when The not-so-ideal scenario would be start to listen for connections once that's done and have the user do a manual attach -- but this is probably not that much better from having the user write |
Beta Was this translation helpful? Give feedback.
-
We have listen mode in the extension now, but it's not like PyDev or PyCharm, in that you have to explicitly start the server (F5), and it'll only handle one incoming connection before stopping. So it's not always-on. On a higher level, though, this is more like the Windows thingy where when it sees a crash, and there are debuggers installed, it'll prompt you to attach one of them to the process. I would expect this to behave very similarly - basically a magic incantation to place into In fact, on Windows, we might even be able to tap into the existing debugger dialog for this, for VS. |
Beta Was this translation helpful? Give feedback.
-
Hello, can you elaborate what you mean by that, please? I think I might not understand. As far as I understand PEP553 it does in fact import and start a debugger (pdb by default). |
Beta Was this translation helpful? Give feedback.
-
I mean that internally when you're running with |
Beta Was this translation helpful? Give feedback.
-
My particular use case for this is to speed up debugging. When debugging a Python application in VSCode (or other IDE's), it runs much slower compared to running the application regularly because of tracing. This means it can take a much longer time to reach the point in the program's execution where one would want to pause it to inspect the state in the debugger. It is possible to to eliminate this speed penalty by adding a This is how this can be achieved:
|
Beta Was this translation helpful? Give feedback.
-
Copied from: microsoft/vscode#60853
In my workflow I am used to inserting import pdb; pdb.set_trace() to break into a fairly minimal CLI debugger. How awesome would it be instead if I could launch into VSCode with as much debugging context available as possible?
I think it would be very nice indeed.
CC @zooba.
Beta Was this translation helpful? Give feedback.
All reactions