Connect to Visual Studio Code for debugging. This function blocks until the debugger is connected! Not recommended for use in startup.py .. note:: See the `user documentation `_ for step-by-step instructions on how to set
(port=5678)
| 443 | |
| 444 | |
| 445 | def connect_vscode_debugger(port=5678): |
| 446 | """ |
| 447 | Connect to Visual Studio Code for debugging. This function blocks until the debugger |
| 448 | is connected! Not recommended for use in startup.py |
| 449 | |
| 450 | .. note:: See the `user documentation <https://docs.binary.ninja/dev/plugins.html#remote-debugging-with-vscode>`_ for step-by-step instructions on how to set up Python debugging. |
| 451 | |
| 452 | :param port: Port number for connecting to the debugger. |
| 453 | """ |
| 454 | # pip install --user debugpy |
| 455 | import debugpy # type: ignore |
| 456 | import sys |
| 457 | if sys.platform == "win32": |
| 458 | debugpy.configure(python=f"{sys.base_exec_prefix}/python", qt="pyside2") |
| 459 | else: |
| 460 | debugpy.configure(python=f"{sys.base_exec_prefix}/bin/python3", qt="pyside2") |
| 461 | debugpy.listen(("127.0.0.1", port)) |
| 462 | debugpy.wait_for_client() |
| 463 | execute_on_main_thread(lambda: debugpy.debug_this_thread()) |
| 464 | |
| 465 | |
| 466 | class UIPluginInHeadlessError(Exception): |
nothing calls this directly
no test coverage detected