You do this by setting the keybindings for Focus Terminal
and Focus Active Editor Group
. These two will allow you to switch the focus between the Editor and the Terminal, without having to just close the terminal.
The other positive is if you perform some action that causes another panel to open such as Output or Problems. Using the keystroke for the editor group will change your focus back to the editor.
I can't say what these are by default because I set this long ago in Code. As you can see from the screenshot below I set them to the same keybinding: ctrl+shift+i.
This makes them act as a toggle switch so it takes the focus back and forth. You can basically just hold down ctrl+shift, then hitting i will move your focus back and forth.