VSCode Debugger Compiled Mode Button Clarification

I noticed there is a red button that only appears when you hover over the “Julia: Compiled Code” (see image below). The tooltip says it runs Julia in compiled mode. So once you’ve clicked it, it runs all the code (including my own) in compiled mode which seems to make debugger pointless (breakpoints no longer work in any of the code). So I’m not sure why you’d ever use this button. Am I missing something?

Also - right now if you click it there is no indication (that I could see, possible I missed something) it is turned “on” or “off” (just stays a red button).


1 Like

I was also puzzled at first when I saw this feature, but it can be convenient to be able to toggle full compiled mode on in some cases.

For example assume you have the following function that is called from your main script/function

function middle_function()
# Some lines of code
bp_1 # <- the first breakpoint you have
# Other lines
inner_function() # <- A call to an inner function that you also contains breakpoints
# Other lines
bp_2 # <- Your second breakpoint
# Other lines

and in this specific debugging instance you want to just check the status of the variables inside middle_function either at bp_1 or at bp_2, you are not interested for the time beeing in stopping at the breakpoints defined inside inner_function or any other breakpoint that are encountered in other functions called from there.

The toggle allows you to run until bp_1, activate compiled mode, press continue and find yourself directly at bp_2 without stopping inside breakpoints of inner_function.

Without this toggle you’d have to manually disable/toggle the various breakpoints that are encountered inside inner_function and you’d also potentially face speed penalties when running things inside inner_function not in compiled mode.

The functionality has its uses, the big problem is that that button is broken and once it’s pressed it will always keep in you compiled mode without allowing you to switch it back off.

Until the issue above is fixed, you can still toggle the compiled mode directly calling the related commands from the command palette in vscode:

I believe the shortcut you see above for disabling the compiled mode is not assigned by default in the extension and I just added it to my configuration file.

The interactive use case did not even occur to me. Now it totally makes sense. Thank you!