Visual Studio Code is a cross-platform IDE.
This tool imports Zephyr (https://github.com/zephyrproject-rtos/zephyr ) source code into Visual Studio Code in the context of a build.
A build must be made before using this tool because certain dependent files are only generated after a build.
This tool can run on both Windows and Linux.
- Exclusion of C files irrelevant to a specific Zephyr build
- Intellisense support
- Unambiguous symbol resolution
- Goto definition/declaration easily
- Rich VS Code extensions
- etc.
This tool will exclude files which are NOT relevant to the selected build context.
But the file exclusion is only done for .c files. Not for other files.
So if you open arbitrary files such as a .h file, that file may NOT be relevant to the current build.
So the symbols in that file may NOT be fully resolved.
In future I may expand the scope of irrelevant file exclusion.
But for .c file browsing, it suffices, I think.
-
Install VS Code
Windows: https://code.visualstudio.com/docs/?dv=win
Linux: https://code.visualstudio.com/docs/?dv=linux64_deb (Ubuntu like)
-
Install VSCode C/C++ Extension:
-
Install Python 3: https://www.python.org/downloads/release/python-373/
-
Download and extract the zip.
-
Goto the extracted folder.
-
Run "python zephyr2vsc.py" to see the usage info and run it.
-
Open the zephyr source dir with VS Code. And wait for the database icon at the bottom right to disappear.
It takes less than 1 min on Windows. Linux is even faster.
This icon indicates that VS Code is parsing the files in the background.
You can hover the mouse on it to see the progress.
-
Below VS Code C/C++ extension bug is not fixed. Currently using a workaround.
-
Below VS Code C/C++ extension bug used to be an issue but has been fixed. Please use VS Code c_cpp_extension >= 0.25.1.
-
Do not change the driver letters with
subst
command on Windows after a Zephyr build is made.Because the .ninja files uses absolute path and the new driver letter will break the relative path handling.