Jump to Terminal in Visual Studio Code When Running PowerShell

I have been spending quite a bit of time in Visual Studio Code (VS Code) lately and it was semi driving me crazy that every time I would scroll up in the Integrated Terminal after running a PowerShell command (reading error messages for example) and then run some PowerShell from the editor again the Integrated Terminal would stay where it was.  I figured there had to be a way to do this in VS Code, and of course there is, and of course someone already figure out how to do it on Stack Overflow.  I am posting this here mostly for my reference.

  1. Install the Macros extension in VS Code
  2. Reload VS Code
  3. Ctrl + Shift + P and type User Settings
  4. Add This Code
    1. "macros": {
        "PowerShellRunSelection": [
          "workbench.action.terminal.scrollToBottom",
          "PowerShell.RunSelection"
        ]
      }
  5. Ctrl + Shift + P and type Keyboard Shortcuts
  6. Click Edit keybindings.json
  7. Add this Code
    1. {
        "key": "f8",
        "command": "macros.PowerShellRunSelection",
        "when": "editorTextFocus && editorLangId == 'powershell'"
      }
  8. The changes should take effect immediately but if they don’t just Reload VS Code and you should be good to go!