Search code examples
debuggingvisual-studio-codebreakpoints

VSCode set shortcut "when" context to detect set breakpoints


I'm trying to set a keyboard shortcut for the command python.debugInTerminal on Visual Studio Code, but I would like it to run only when a breakpoint is created in the file. Inversely, if there are no set breakpoints in the file, this command should not run.

Is there a "when" context term to define this? For example, there is one called breakpointsFocused, but I dont think this is right.


Solution

  • There is a breakpointsExist true/false context key.

    Open the Developer Tools/Console and then invoke the command

    Developer: Inspect Context Keys

    and click anywhere in vscode. Then in the Console open up the last object which should have a long list of available context keys. Search for breakpoint and there are a few.