fix(clangd[lsp]): Args aren't being passed correctly. #193
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There've been updates to
clangd (llvm, 13 - 14)
that modified the method to pass args to the lsp.TL;DR: We need to use the
cmd
table to pass clangd's arguments and set command-line arguments of the compiler (e.g.,clang++
) via clangd's configuration file in the source tree or an OS-specific directory. For most cases,--query-driver
MUST be set so that clangd can correctly parse system's includes (e.g., for using#include<type_traits>
), especially when the user doesn't providecompile_commands.json
orcompile_flags.txt
.Detailed Discussion about Configuration File (Maybe we need to add this to the wiki?)
Configuration is stored in YAML files. These are either:
.clangd
in the source tree. (clangd searches in all parent directories of the active file)..clangd
can be deleted. These were used for temporary storage by clangd before version 11.)config.yaml
file in an OS-specific directory:%LocalAppData%\clangd\config.yaml
, typicallyC:\Users\Bob\AppData\Local\clangd\config.yaml
.~/Library/Preferences/clangd/config.yaml
.$XDG_CONFIG_HOME/clangd/config.yaml
, typically~/.config/clangd/config.yaml
.Example (My) Configuration
For more details visit: nvim-lspconfig's server setup document and LLVM clangd's website.