Using VSCode with QMK

Setting up Visual Studio Code for QMK Development

​Visual Studio Code (VS Code) is an open-source code editor that supports many different programming languages.

Using a full-featured editor such as VS Code provides many advantages over a plain text editor, such as:

intelligent code completion

convenient navigation in the code

refactoring tools

build automation (no need for the command-line)

a graphical front end for GIT

many other tools such as debugging, code formatting, showing call hierarchies etc.

The purpose of this page is to document how to set up VS Code for developing QMK Firmware.

This guide covers how to configure everything needed on Windows and Ubuntu 18.04

Set up VS Code

Before starting, you will want to make sure that you have all of the build tools set up, and QMK Firmware cloned. Head to the the Newbs Getting Started Guide to get things set up, if you haven't already.

Installing VS Code

This part is super simple. However, there is some configuration that we need to do to ensure things are configured correctly.

Configuring VS Code

First, we need to set up IntelliSense. This isn't strictly required, but it will make your life a LOT easier. To do this, we need to create the .vscode/c_cpp_properies.json file in the QMK Firmware folder, You can do this all manually, but I've done most of the work already.

Grab this file and save it. You may need to edit this file, if you didn't install MSYS2 to the default location, or are using WSL/LxSS.

Once you have saved this file, you will need to reload VS Code, if it was already running.

?> You should see an extensions.json and settings.json file in the .vscode folder, as well.

Now, we will set up the MSYS2 window to show up in VSCode as the integrated terminal. This has a number of advantages. Mostly, you can control+click on errors and jump to those files. This makes debugging much easier. It's also nice, in that you don't have to jump to another window.

Click File > Preferences > > Settings </kbd>

Click on the {} button, in the top right to open the settings.json file.

Set the file's content to:

{

"terminal.integrated.shell.windows":"C:\\msys64\\usr\\bin\\bash.exe",

"terminal.integrated.env.windows":{

"MSYSTEM":"MINGW64",

"CHERE_INVOKING":"1"

},

"terminal.integrated.shellArgs.windows":[

"--login"

],

"terminal.integrated.cursorStyle":"line"

}

If there are settings here already, then just add everything between the first and last curly brackets.

?> If you installed MSYS2 to a different folder, then you'll need to change the path for terminal.integrated.shell.windows to the correct path for your system.

Hit Ctrl-` (grave) to bring up the terminal.

This should start the terminal in the workspace's folder (so the qmk_firmware folder), and then you can compile your keyboard.

​VS Live Share Extension Pack - [Optional] - This extension allows somebody else to access your workspace (or you to access somebody else's workspace) and help out. This is great if you're having issues and need some help from somebody.

​VIM Keymap - [Optional] - For those that prefer VIM style keybindings. There are other options for this, too.

​Travis CI Status - [Optional] - This shows the current Travis CI status, if you have it set up.