Skip to content

Commit

Permalink
Add an item to the FAQ re: C/C++ and #include (#4308)
Browse files Browse the repository at this point in the history
I found this after a bit of Googling and I thought it would be helpful for the FAQ. Thanks!
  • Loading branch information
dlbeswick authored Mar 16, 2024
1 parent 40c876c commit 802e256
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/page/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,17 @@ The issue is caused by `clojure-lsp` server being more aggressive with formattin
``` elisp
(setq lsp-enable-suggest-server-download nil)
```

---
### :grey_question: How can I stop #include statements being automatically inserted when editing C/C++ code?

You can use `lsp-clients-clangd-args` to configure your clangd. Add the following:

``` elisp
(setq lsp-clients-clangd-args
'("--header-insertion=never"))
```

For more flags, see clangd --help.

(Thanks to [Martingale on Emacs StackExchange](https://emacs.stackexchange.com/questions/58015/how-to-stop-lsp-mode-including-headers-automatically-for-c-c-code) for this answer!)

0 comments on commit 802e256

Please sign in to comment.