You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then, open VSCode *user* settings, so things will be automatically set up for all projects you open.
131
131
132
-
Add the following two, separate entries to `"clangd.arguments"`:
132
+
Add the following three separate entries to `"clangd.arguments"`:
133
133
```
134
134
--header-insertion=never
135
135
--compile-commands-dir=${workspaceFolder}/
136
+
--query-driver=/**/*
136
137
```
137
138
(Just copy each as written; VSCode will correctly expand ${workspaceFolder} for each workspace.)
138
-
- They get rid of (overzealous) header insertion and are needed to help it find the compile commands, even when browsing system headers outside the source tree.
139
+
- They get rid of (overzealous) header insertion; locate the compile commands correctly, even when browsing system headers outside the source tree; and cause clangd to interrogate Bazel's compiler wrappers to figure out which system headers they include by default.
139
140
- If your Bazel WORKSPACE is a subdirectory of your project, change --compile-commands-dir to point into that subdirectory by overriding *both* flags in your *workspace* settings
140
141
141
142
@@ -146,6 +147,10 @@ If afterwards clangd doesn't prompt you to download the actual clangd server bin
146
147
147
148
You may need to subsequently reload VSCode [(CMD/CTRL+SHIFT+P)->reload] for the plugin to load. The clangd download should prompt you to do so when it completes.
148
149
150
+
#### If you work on your repository with others...
151
+
152
+
... and would like these settings to be automatically applied for your teammates, also add the settings to the VSCode *workspace* settings and then check `.vscode/settings.json` into source control.
153
+
149
154
### Other Editors
150
155
151
156
If you're using another editor, you'll need to follow the same rough steps as above: [get clangd set up to extend the editor](https://clangd.llvm.org/installation.html#editor-plugins) and then supply the flags.
0 commit comments