Skip to content

Commit 8b16750

Browse files
committed
Add --query-driver=/**/* to recommended settings. Also recommend workspace settings for teams.
Fixes #33 Fixes #32 See also: clangd/clangd#1079 #15 (comment)
1 parent 87f22e3 commit 8b16750

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,16 @@ code --install-extension llvm-vs-code-extensions.vscode-clangd
127127
code --uninstall-extension ms-vscode.cpptools
128128
```
129129

130-
Then, open VSCode user settings.
130+
Then, open VSCode *user* settings, so things will be automatically set up for all projects you open.
131131

132-
Add the following two, separate entries to `"clangd.arguments"`:
132+
Add the following three separate entries to `"clangd.arguments"`:
133133
```
134134
--header-insertion=never
135135
--compile-commands-dir=${workspaceFolder}/
136+
--query-driver=/**/*
136137
```
137138
(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.
139140
- 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
140141

141142

@@ -146,6 +147,10 @@ If afterwards clangd doesn't prompt you to download the actual clangd server bin
146147

147148
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.
148149

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+
149154
### Other Editors
150155

151156
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

Comments
 (0)