settings.json file to understand Ladybird.
The WSL Remote extension allows you to use VS Code in Windows while using the normal WSL workflow. This works well, but for code comprehension speed you should put the ladybird directory on your WSL root partition.
Recommended extensions
The recommended extensions for VS Code include:Configuration
Run initial build
Run
./Meta/ladybird.py build at least once to kick off downloading and building vcpkg dependencies.Select CMake preset
The CMake Tools plugin should automatically detect the
CMakePresets.json at the root of the repository. Selecting and activating the default preset should be enough to get started after the initial build.Code comprehension
Clangd has the best support for modern compilers, especially if configured as noted below. The Microsoft C/C++ tools can work, but may require more configuration.clangd
The official clangd extension can be used for C++ comprehension. It is recommended in general, as it is most likely to work on all platforms. clangd usescompile_commands.json files to understand the project. CMake will generate these in Build/release.
Run ./Meta/ladybird.py run ladybird at least once to generate the compile_commands.json file.
Known issues
Microsoft C/C++ tools
Enabling the extension in the same workspace as the clangd and clang-format extensions will cause conflicts. If you choose to use Microsoft C/C++ Tools rather than clangd and clang-format, use the following
c_cpp_properties.json to circumvent some errors.Formatting
clangd provides code formatting out of the box using theclang-format engine. clang-format support is also included with the Microsoft C/C++ tools (see above). The settings below include a key that makes the Microsoft extension use the proper style.
Settings
These belong in the.vscode/settings.json of Ladybird.
Customization
Custom tasks
You can create custom tasks (.vscode/tasks.json) to quickly compile Ladybird. The following three example tasks should suffice in most situations, and allow you to specify the build system to use, as well as give you error highlighting.
Debugging
Mac
If you want to run the debugger, first place the content below in.vscode/launch.json in the root of the project.
--debug-process WebContent flag:
Linux
For Linux, thelaunch.json will instead be the file below.
gdb (the GNU Debugger) installed.
License snippet
The following snippet may be useful if you want to quickly generate a license header, put it in.vscode/ladybird.code-snippets: