lsp-mode and clangd to work well.
clangd
The official clangd extension can be used for C++ comprehension.Run cmake (
Meta/ladybird.py run ladybird or similar) at least once for clangd to work, as doing so will generate the Build/release/compile_commands.json that is needed by clangd.lsp-mode
Configurelsp-mode with the following settings:
clangd installation options
There are a few different ways to specify which clangd to use:System clangd (default)
By default, without configuration
lsp-mode will try to find and use your system clangd. This is the easiest solution, but your system clangd might be out of date.Manual path specification
You can manually specify any
clangd binary with lsp-clangd-binary-path, as shown in the use-package example above.lsp-mode managed installation
You can have
lsp-mode manage your clangd installation with emacs’ lsp-install-server. This will install a clangd binary for you.clang-format
There are multiple packages to handle auto formatting withclang-format, within emacs. Choose what works best for your setup:
Using lsp-mode for formatting
Alternatively, this can be done without additional packages, usinglsp-mode. You can use the following .dir-locals.el file placed in the project root: