From 47defa284948993ba257158a4de4e8094854cbf4 Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Tue, 5 Nov 2024 21:43:31 +0000 Subject: [PATCH] docs: Add documentation for configuring clangd in C-only mode (#20255) --- docs/src/languages/c.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/src/languages/c.md b/docs/src/languages/c.md index c04028530066888dc465637594ce7795fa55e111..4f042b7ea634d04b8ec748d1b5a24045069c0c1f 100644 --- a/docs/src/languages/c.md +++ b/docs/src/languages/c.md @@ -2,9 +2,14 @@ C support is available natively in Zed. - - - Tree Sitter: [tree-sitter/tree-sitter-c](https://github.com/tree-sitter/tree-sitter-c) - Language Server: [clangd/clangd](https://github.com/clangd/clangd) + +## Clangd: Force detect as C + +Clangd out of the box assumes mixed C++/C projects. If you have a C-only project you may wish to instruct clangd to all files as C using the `-xc` flag. To do this, create a `.clangd` file in the root of your project with the following: + +```yaml +CompileFlags: + Add: [-xc] +```