Navigate to this link to download the latest version of Visual Studio Code compatible with your machine.
The specifics of Visual Studio Code: check this out, as well as this.
Open Visual Studio Code and navigate to the "Extensions" tab (the squares icon on the left sidebar). Search for and install the "CircuitPython" extension.
Link to it: https://marketplace.visualstudio.com/items?itemName=joedevivo.vscode-circuitpython
Important Note: Due to a bug in the latest release of this extension, you must manually install a specific older version for it to function correctly. Once installed, click the caret on the Uninstall button to open the dropdown menu, select Install Specific Version... from the dropdown, choose version 0.1.20 from the list, and Restart Extension in VS Code when prompted, see images below.
Plug your CircuitPython board with your assembled circuit in to your machine.
From the main page of VS Code, open up the CircuitPython Drive. The image below shows where to find this.
Important: Make sure to open the entire CIRCUITPY (D:) drive.
There are usually a few other extensions or dependencies that might be required depending on your existing VS Code profile. These should automatically download once you open the main.py or code.py file.
Ensure that VS Code is configured for your specific board.
Open the Command Palette by navigating to View > Command Palette (or pressing Ctrl+Shift+P / Cmd+Shift+P).
Type CircuitPython: Choose CircuitPython Board and select it.
Scroll and choose your specific board (e.g., Metro M0 Express) from the list of available boards.
You can access serial output and several other CircuitPython commands through the Command Palette. To access this, press View > Command Palette. A text bar should drop down from the top of the screen. Type in CircuitPython to see the full list of commands you can use. Select CircuitPython: Open Serial Monitor to view the output from your board.