clangd LSP
name: clangd-lsp
by bowen31337 · published 2026-03-22
$ claw add gh:bowen31337/bowen31337-clangd-lsp---
name: clangd-lsp
description: C/C++ language server (clangd) providing code intelligence, diagnostics, and formatting for .c, .h, .cpp, .cc, .cxx, .hpp, .hxx files. Use when working with C or C++ code that needs autocomplete, go-to-definition, find references, error detection, or refactoring support.
---
# clangd LSP
C/C++ language server integration providing comprehensive code intelligence through clangd (part of LLVM).
Capabilities
Installation
Via Homebrew (macOS)
brew install llvm
# Add to PATH
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"Via package manager (Linux)
# Ubuntu/Debian
sudo apt install clangd
# Fedora
sudo dnf install clang-tools-extra
# Arch Linux
sudo pacman -S clangWindows
winget install LLVM.LLVMOr download from [LLVM releases](https://github.com/llvm/llvm-project/releases).
Verify installation:
clangd --versionUsage
The language server runs automatically in LSP-compatible editors. For manual operations:
Compile
gcc file.c -o output # C
g++ file.cpp -o output # C++
clang file.c -o output # with clangFormat code
clang-format -i file.cppStatic analysis
clang-tidy file.cpp -- -std=c++17Configuration
Create `.clangd` in project root:
CompileFlags:
Add: [-std=c++17, -Wall, -Wextra]
Remove: [-W*]
Diagnostics:
UnusedIncludes: Strict
MissingIncludes: StrictOr `compile_commands.json` for complex projects:
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .
# or
bear -- makeIntegration Pattern
When editing C/C++ code:
1. clangd uses `compile_commands.json` for project understanding
2. Run `clang-format` to format code
3. Use `clang-tidy` for static analysis
4. Compile with warnings enabled (`-Wall -Wextra`)
Common Flags
**Compile flags:**
**clang-tidy checks:**
clang-tidy file.cpp --checks='*' --
clang-tidy file.cpp --fix -- # Auto-fixMore Information
More tools from the same signal band
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
Sign plugins, rotate agent credentials without losing identity, and publicly attest to plugin behavior with verifiable claims and authenticated transfers.
The philosophical layer for AI agents. Maps behavior to Spinoza's 48 affects, calculates persistence scores, and generates geometric self-reports. Give your...