How to debug with intellisense

May 14 at 3:58 PM
Hello all,

First off thanks for this great project. It has some really great features that I'm excited to try out, namely the remote debugging.

The issue that I'm running into is that I don't know how best to debug so that I can get intellisense in the immediate window when I hit a breakpoint. The project I'm working on is fairly large and my breakpoint is buried multiple files down and in a PyQt Gui application. If I launch the project with the standard F5 I hit my breakpoint and I can interactively interact with the variables in the immediate window. Unfortunately the immediate window doesn't have code highlighting, code completion, intellisense, etc. I can also execute the project in Python interactive but with this the breakpoints aren't triggered. I'm probably just missing something simple here.

Thanks,
Colin
Coordinator
May 14 at 4:26 PM
You'd probably prefer to be using the Debug Interactive Window

Rather than trying to make the Immediate Window work better, we decided to bypass it and give you a proper repl that will execute commands in the process you are debugging. All your imported modules are there (and you can import more), and you'll get full IntelliSense as reported by the running process (with dir(), etc.). You also get syntax highlighting and you can write multiline blocks of code. Any code you call from the Debug Interactive will hit breakpoints that you have set.

The downside is that you can only use this while your program is broken in the debugger. Once you start running again, you have to stop using it (just like the Immediate window), and you can't start running your program from this repl.

(There is a slightly more advanced option where you can "enable attaching" in the interactive options for a particular version of Python, then type $attach in that interactive window, which will start the debugger for anything you do in that window. But I think you'll be happier with the Debug Interactive window.)
May 14 at 7:29 PM
Thanks that was exactly what I was after.



Colin Talbert
GIS Analyst and Developer
US Geological Survey

[email removed]

USGS Fort Collins Science Center
2150 Centre Ave. Bldg. C
Fort Collins, CO 80526
(970) 226-9425

USGS North Central Climate Science Center
(970) 492-4283

Work schedule:
Monday - 7:00 - 3:00 (NC CSC)
Tuesday - 7:00 - 3:00 (NC CSC)
Wednesday - 7:00 - 3:00 (FORT)
Thursday - 7:00 - 5:00 (NC CSC)
Friday - 7:00 - 5:00 (FORT)