wiki:Clangd

Version 2 (modified by Brandon, 3 years ago) ( diff )

--

Clangd

clangd is language server designed to provide features like autocomplete, go to definition, and refactoring to a wide range of editors.

Setting up clangd

Generate compile_command.json

macOS

clangd relies on compile_commands.json file to work, which can be generated on macOS by running

make r EXPORT_COMPILE_COMMANDS=YES
generate-compile-commands WebKitBuild/Release

I would recommend running this command each time you pull the latest code.

If you add or remove files during development, just compile with make and run the generate-compile-commands.

Linux and Windows

For other platforms using cmake, generating compile_commands.json can be accomplished by running

cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1

Configure your editor

Every editor will have slightly different method to setup clangd.

The clangd website provides an excellent setup guide for most popular editors.

Editors Links
BBEdit https://www.barebones.com/support/bbedit/lsp-notes.html
Clion https://www.jetbrains.com/help/clion/settings-languages-cpp-clangd.html
Emacs https://clangd.llvm.org/installation#editor-plugins
Vim https://clangd.llvm.org/installation#editor-plugins
VSCode https://clangd.llvm.org/installation#editor-plugins
Sublime Text https://clangd.llvm.org/installation#editor-plugins

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.