Search code examples
visual-studio-codekeyboard-shortcutsvscode-debugger

Single VS Code shortcut for start/restart


The default VS Code shortcuts seem to be:

  • F5: start
  • Shift-F5: stop
  • F8: continue (if paused)
  • Shift-F8: restart

The thing I most often want to do is "take any changes into account and run", which means three different things depending on state:

  • if not running: F5
  • if running: Shift-F8 (or Shift-F5, F5)
  • if paused: Shift-F8 (or Shift-F5, F5)

Is there a way to configure it so that one key combination will start (if not running) or restart?


Solution

  • Oh, it seems to be as simple as: Set "F5" as the shortcut for "Debug: Restart" (as well as for "Debug: Start"). The When setting of "inDebugMode" means VS Code knows to perform a restart rather than a start.