diff --git a/.clangd b/.clangd new file mode 100644 index 0000000..2e24d4a --- /dev/null +++ b/.clangd @@ -0,0 +1,7 @@ +# https://clangd.llvm.org/config +CompileFlags: + # Our toolchain wraps clang in a script, and clangd's system include extractor treats + # the output of that script differently just based on the file name. We + # replace the path to the script with the path to the actual clang binary so that + # clangd parses the output correctly. + Compiler: external/llvm_toolchain_files/bin/clang diff --git a/.vscode/settings.json b/.vscode/settings.json index ffddb98..902ad27 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,12 +1,14 @@ { "files.watcherExclude": { + ".cache/**": true, "bazel-*/**": true, "external/**": true }, "clangd.arguments": [ "--header-insertion=never", "--compile-commands-dir=${workspaceFolder}/", - "--query-driver=**" + "--query-driver=**", + "--enable-config" ], "clangd.path": "${workspaceFolder}/external/llvm_toolchain_files/bin/clangd" } diff --git a/README.md b/README.md index a076cb8..ddb7f10 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Should work on Linux and MacOS. * Install `bazel` or `bazelisk` * Verify that you can build and test: -``` +```sh bazel test //... ``` @@ -22,22 +22,14 @@ Install the recommended extensions. See .vscode/extensions.json. Create a compilation database: ```sh -bazel build //... -bazel run @hedron_compile_commands//:refresh_all +bazel build //... && bazel run @hedron_compile_commands//:refresh_all ``` Then configure [clangd](https://clangd.llvm.org/). If you're using VS Code, the .vscode/settings does this for you, and .vscode/extensions.json already recommends installing the clangd extension. -Otherwise, set these clangd args: - -``` ---header-insertion=never ---compile-commands-dir=${workspaceFolder}/ ---query-driver=** -``` - +Otherwise, copy the clangd args from the [.vscode/settings.json](.vscode/settings.json). ## Status