cpp.md

 1# C++
 2
 3C++ support is available natively in Zed.
 4
 5- Tree Sitter: [tree-sitter/tree-sitter-cpp](https://github.com/tree-sitter/tree-sitter-cpp)
 6- Language Server: [clangd/clangd](https://github.com/clangd/clangd)
 7
 8## Binary
 9
10You can configure which `clangd` binary Zed should use.
11
12To use a binary in a custom location, add the following to your `settings.json`:
13
14```json
15{
16  "lsp": {
17    "clangd": {
18      "binary": {
19        "path": "/path/to/clangd",
20        "arguments": []
21      }
22    }
23  }
24}
25```
26
27If you want to disable Zed looking for a `clangd` binary, you can set `ignore_system_version` to `true`:
28
29```json
30{
31  "lsp": {
32    "clangd": {
33      "binary": {
34        "ignore_system_version": true
35      }
36    }
37  }
38}
39```
40
41## Arguments
42
43You can pass any number of arguments to clangd. To see a full set of available options, run `clangd --help` from the command line. For example with `--function-arg-placeholders=0` completions contain only parentheses for function calls, while the default (`--function-arg-placeholders=1`) completions also contain placeholders for method parameters.
44
45```json
46{
47  "lsp": {
48    "clangd": {
49      "binary": {
50        "path": "/path/to/clangd",
51        "arguments": ["--function-arg-placeholders=0"]
52      }
53    }
54  }
55}
56```
57
58## More server configuration
59
60In the root of your project, it is generally common to create a `.clangd` file to set extra configuration.
61
62```text
63CompileFlags:
64  Add:
65    - "--include-directory=/path/to/include"
66Diagnostics:
67  MissingIncludes: Strict
68  UnusedIncludes: Strict
69```
70
71For more advanced usage of clangd configuration file, take a look into their [official page](https://clangd.llvm.org/config.html).