In contrast to fully integrated IDEs, setting up Visual Studio Code (short. VSCode) requires you to setup a number of software packages, which finally work together to build the complete development environment. The software packages can be split into three groups:

VSCode and plugins

Arm build tools (compiler etc.)

Debug tools

The packages can be installed in any order (well, almost: VSCode must be installed before VSCode plugins can be installed).
Understanding the purpose of individual components helps to debug potential problems and understand the behavior of the system. Therefore I want to first give an overview over these parts.

You can look at VSCode as an intelligent text editor which provides an extensive framework to add functionality through plugins. VSCode includes a project explorer, which can show the contents of one or multiple folders as a workspace.
There is more information on required plugins further down in this list.

C/C++:
This plugin offers many features to simplify editing of C/C++ code, including Syntax highlighting, Intellisense (finding definitions of symbols), auto-completion of keywords and identifier names, and marking syntax errors while typing.

Cortex-Debug:
This plugin adds support for debugging ARM executables through a GDB Server.

GNU Arm Embedded Toolchain:
This is the C/C++ compiler und linker along with additional tools. It is used to turn your source code into a binary executable.

CMake:
CMake is a tool which turns compiler-independent project definitions into compiler-specific project definitions.
NXP provides such independent project definitions in CMakeLists.txt files. CMake converts these into makefiles that can be processed by the GNU Arm Embedded Toolchain.

Segger J-Link: (for J-Link hardware debugger only)
This software package contains the J-Link GDB server, which connects to VSCode on one side, and to the J-Link JTAG hardware on the other side.

OpenOCD: (for generic hardware debugger)
OpenOCD is an open-source debugger, supporting a wide variety of JTAG hardware interfaces. For customers using a JTAG adapter other than the J-Link, this probably is the matching software. The package contains a GDB server, which connects to VSCode on one side, and to the J-Link JTAG hardware on the other side.

To do hardware debugging, VSCode depends on external GDB servers to access the hardware over JTAG. Depending on your JTAG adapter you might need one or the other software package mentioned below.
The installations can work side by side.

Attention: The installation instructions of OpenOCD contain a number of manual steps. Depending on your actual hardware and software setup, you may need to adjust the installation.This is a generic guideline which helps you to avoid certain pitfalls, but Toradex cannot make sure that the instructions will work for all setups. The installation shouldn't be too complex, but it will require some work and some technical understanding to get it running.We will try to improve the OpenOCD user experience in the future.

Download the installer openocd-0.10.0.7z

Unzip the contents to c:\Program Files
(so the binaries end up in c:\Program Files\openocd-0.10.0\bin )

Keeping all the default settings for installation is just fine.

Open the VSCode user settings file settings.json:
File → Preferences → Settings
Select User settings
Enter "json" in the search bar (with or without double quotes)
Locate a link "Edit in settings.json" and click on it. This will open the file C:\Users\YOURNAME\AppData\Roaming\Code\User\settings.json

Add the following two lines to the settings.json file, between the curly braces {}:"cortex-debug.armToolchainPath": "C:/PROGRA~2/GNUTOO~1/82018-~1/bin","cortex-debug.openocdPath": "C:/Program Files/openocd-0.10.0/bin/openocd.exe"
Please note:
(a) The paths on your system might be different. Make sure the path matches your actual file locations.
(b) The armToolchainPath needs to be given in legacy-compatible 8.3 location. You can use dir /x in the command shell to see the short names.
(c) All paths in VSCode are defined with forward-slashes /

Save the file settings.json

Locate the OpenOCD configuration file for your JTAG adapter. For the Olimex ARM-USB-OCD-H adapter, the file can be found here:C:\Program Files\openocd-0.10.0\share\openocd\scripts\interface\ftdi\olimex-arm-usb-ocd-h.cfg

Execute the installer. You may need to adjust the folder name if you downloaded the .deb package to a different location:osboxes@osboxes:~$ sudo apt -y install ~/Downloads/code_1.37.1-1565886362_amd64.deb

Attention: The installation instructions of OpenOCD contain a number of manual steps. Depending on your actual hardware and software setup, you may need to adjust the installation.This is a generic guideline which helps you to avoid certain pitfalls, but Toradex cannot make sure that the instructions will work for all setups. The installation shouldn't be too complex, but it will require some work and some technical understanding to get it running.We will try to improve the OpenOCD user experience in the future.

(The basic installation was already be done as part of step 2. above.)

Open the VSCode user settings file settings.json:
File → Preferences → Settings
Select User settings
Enter "json" in the search bar (with or without double quotes)
Locate a link "Edit in settings.json" and click on it. This will open the file ~/.config/Code/User/settings.json

Add the following line to the settings.json file, between the curly braces {}:

"cortex-debug.armToolchainPath": "/usr/bin",

Please note:
(a) The paths on your system might be different. Make sure the path matches your actual file locations.

Save the file settings.json

Locate the OpenOCD configuration file for your JTAG adapter. For the Olimex ARM-USB-OCD-H adapter, the file can be found here:/usr/share/openocd/scripts/interface/ftdi/olimex-arm-usb-ocd-h.cfg