From b88b2b18b93475c00fb8fa555982030e8035e2a5 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Wed, 30 Sep 2026 17:45:50 +0200 Subject: [PATCH] chore(clangd): change filetypes and notes on how to get it to recognize some local headers --- README.md | 5 +++++ nvim/lua/plugins/lsp/ls/c.lua | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a20bc60..1040d38 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,11 @@ unless you add a `.luarc.json` file with the following content: } ``` +### Clangd +If `clangd` can't find some headers, then you need to create a `compile_commands.json` file. +When a `Makefile` is present (or other build tools such as `cmake` are used, look up how to do that online), you can use `bear` as follows to create this file: +`bear -- make`. That's it + ### Java #### jdtls Ensure you have jdk21-opnejdk or newer installed. On Arch (and derivatives) you can switch the preferred java version using `archlinux-java set ` diff --git a/nvim/lua/plugins/lsp/ls/c.lua b/nvim/lua/plugins/lsp/ls/c.lua index 7734c53..4917d07 100644 --- a/nvim/lua/plugins/lsp/ls/c.lua +++ b/nvim/lua/plugins/lsp/ls/c.lua @@ -11,7 +11,7 @@ lsp.config("clangd", { "--suggest-missing-includes", "--clang-tidy", }, - filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto", "ino" }, + filetypes = { "c", "cpp", "objc", "objcpp", "cuda" }, capabilities = opts.capabilities, on_attach = opts.on_attach_no_formatting, })