diff options
| author | Sam Estep <sam@samestep.com> | 2025-07-28 17:11:11 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-28 21:11:11 +0000 |
| commit | a2d93ae0122aff62866e9266e5e51d4615a00783 (patch) | |
| tree | 623dbfc90be3142359d044725a347ee7bb4bb880 | |
| parent | 5f8475bee2589b8e851c856135cf10758e859e72 (diff) | |
Disable automatic `#include` insertion for clangd (#7951)
| -rw-r--r-- | .clangd | 2 | ||||
| -rw-r--r-- | flake.lock | 6 | ||||
| -rw-r--r-- | flake.nix | 21 |
3 files changed, 22 insertions, 7 deletions
diff --git a/.clangd b/.clangd new file mode 100644 index 000000000..4fa2e43b9 --- /dev/null +++ b/.clangd @@ -0,0 +1,2 @@ +Completion: + HeaderInsertion: Never # This repo does not follow include-what-you-use. diff --git a/flake.lock b/flake.lock index f64cb7ae4..41b3be142 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1751949589, - "narHash": "sha256-mgFxAPLWw0Kq+C8P3dRrZrOYEQXOtKuYVlo9xvPntt8=", + "lastModified": 1753432016, + "narHash": "sha256-cnL5WWn/xkZoyH/03NNUS7QgW5vI7D1i74g48qplCvg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9b008d60392981ad674e04016d25619281550a9d", + "rev": "6027c30c8e9810896b92429f0092f624f7b1aace", "type": "github" }, "original": { @@ -21,10 +21,23 @@ # the latter brings in GCC by default on Linux. devShell = pkgs.mkShellNoCC { buildInputs = [ - # Must put `clang-tools` before `clang` for clangd to work properly. - # We use `llvmPackages_17.clang-tools` instead of just `clang-tools` - # to match the `clang-format` version used in CI. - pkgs.llvmPackages_17.clang-tools + # We must list clangd before the `clang` package to make sure it + # comes earlier on the `PATH`, and we must get it from the + # `clang-tools` package so that it is wrapped properly. + (pkgs.linkFarm "clangd-21" [ + { + name = "bin/clangd"; + # New enough to support `HeaderInsertion: Never` in `.clangd`. + path = "${pkgs.llvmPackages_21.clang-tools}/bin/clangd"; + } + ]) + (pkgs.linkFarm "clang-format-17" [ + { + name = "bin/clang-format"; + # Match the clang-format version used in CI. + path = "${pkgs.llvmPackages_17.clang-tools}/bin/clang-format"; + } + ]) pkgs.clang pkgs.cmake |
