Visual Studio Code is a great and simple IDE that can be used to build & develop with for Matter.
Matter supports the docker / remote container workflow in Visual Studio Code, and has a container environment setup automatically. You can read more about this workflow here.
Tested on:
- macOS 10.5
- Windows 10 Pro + WSL + Ubuntu 18 LTS
- Windows Only Enable the Windows Subsystem for Linux (WSL) following instructions here: https://docs.microsoft.com/en-us/windows/wsl/install-win10
- Windows Only Install Ubuntu from the Windows App Store here: https://www.microsoft.com/en-us/p/ubuntu-1804-lts/9n9tngvndl3q
- Install Docker for your operating system of choice from here: https://docs.docker.com/install
- Install Visual Studio Code for your operating system of choice here: https://code.visualstudio.com/Download
- Install Git if you haven't already
- Windows Only Enable git to use LF instead of CLRF by default:
git config --global core.autocrlf false
- Git clone the main Matter repository here: https://github.com/project-chip/connectedhomeip
- Launch Visual Studio Code, and open the cloned folder from
- Install the Remote - Containers extension for Visual Studio Code, this extension allows you to use docker containers as a development backend.
- Once this is installed, you'll be prompted to reload Visual Studio Code, do so
- At the bottom right of your Visual Studio Code window you should have a new box prompting you to re-open the window as a container. Hit yes.
- Windows Only Update your Visual Studio Code settings as documented here:
https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration
to use Bash on Ubuntu (on Windows) eg:
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe"
- Now your local machine is building a docker image that has all the tools necessary to build and test Matter. This can take some time, but will eventually complete and open up the source tree
- Under the "Terminal" menu (or using another shortcut to the same tool), select "Run Task..."
- Select the "Bootstrap" task
- Under the "Terminal" menu select "Run Build Task..."
Located in the tasks json file you'll find a list of tasks that can be run from the "Run Task..." command. Example tasks are "Clean", "Run Pretty Check"
Developers are encouraged to add tasks to the tasks json over time to make sure everyone is using the same base configuration and build.
- Main Build - Build the default configuration (i.e., Linux OpenSSL)
- Run Unit and Functional Tests - Test the default configuration
- Build & Test (all) - Build & Test various configurations (Linux variants, Android, EFR32)
- Update compilation database - Update the database used by IntelliSense (needed for cross references, completion)
- Bootstrap - On a clean tree, pull in the third party dependencies required
- Clean Output - Remove build artifacts
- Clean Tree - Full (and destructive) git clean of the tree
Located in the launch json file you'll find a list of build & run jobs that can be run from the "Run" tab and start a run or debug session.
Developers are encouraged to add tasks to the launch json over time to make sure everyone is using the same base debugging setup.
- Run task: "Build & Test (all)"
- Highly recommend you read through this page to learn how to configure Visual Studio Code to suit your style: https://code.visualstudio.com/docs/getstarted/settings
- Great primer set of videos here https://code.visualstudio.com/docs/getstarted/introvideos
- Configure the editor to format on save, in your Visual Studio Code Settings:
"editor.formatOnSave": true
- Configure the clang-format extension
@ext:xaver.clang-format
, it is installed in the docker container. Make sure all languages are enabled