Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automatically terminate last instance when running or debugging in VS Code [duplicate]

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?

like image 363
Steve Bennett Avatar asked Apr 01 '26 10:04

Steve Bennett


1 Answers

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.

like image 97
Steve Bennett Avatar answered Apr 03 '26 17:04

Steve Bennett