mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
4ffca2089e
The reason for this change is that CMake/vcpkg are unable to detect a change to VCPKG_LIBRARY_LINKAGE. So when we switch to dynamic builds, the switch would be non-functional, and every developer would have to remove their Build and vcpkg cache directories manually. By changing these directories, vcpkg is able to detect it must rebuild.
1.9 KiB
1.9 KiB
Emacs Project Configuration
Emacs can be configured with lsp-mode
and clangd
to work well.
clangd
The official clangd extension can be used for C++ comprehension.
Run cmake (Meta/ladybird.sh 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
(use-package lsp-mode
:hook ((c++-mode) . lsp-deferred)
:commands lsp
:config
(setq lsp-clients-clangd-args '("-j=4" "-background-index" "--log=error" "--clang-tidy" "--enable-config"))
;; Optionally, set the location of clangd -- See notes below for options.
(setq lsp-clangd-binary-path "/usr/bin/clangd"))
clangd
There are a few different ways to specify which clangd to use:
- By default, without configuration
lsp-mode
will try to find and use your systemclangd
. This is the easiest solution, but your system clangd might be out of date. - You can manually specify any
clangd
binary withlsp-clangd-binary-path
, as shown in the use-package example above. - You can have
lsp-mode
manage yourclangd
installation with emacs'lsp-install-server
. This will install aclangd
binary for you. - You can build the LLVM toolchain, including
clangd
, from Ladybird's repository. This is an advanced option that is not currently documented.
clang-format
There are multiple packages to handle auto formatting with
clang-format
, within emacs. Choose what works best for your setup:
Alternatively, this can be done without additional packages, using lsp-mode
.
You can use the following .dir-locals.el
file placed in the project root:
((c++-mode
(eval add-hook 'before-save-hook #'lsp-format-buffer nil t)))