Questions tagged [clangd]

clangd is a language server that implements the Language Server Protocol

clangd is a language server that implements the Language Server Protocol

156 questions
3
votes
1 answer

How to use compile_flags.txt for C++ programming and suppress C++ related issues for development in C?

Recently I wanted to use a compile_flags.txt-file to allow development in C++20. Clangd shows annoying warnings when using structured-bindings and C++-related features and so I created this file. My compile_flags.txt-file looks like…
3
votes
1 answer

In VSCode, how can I disable the GCC warnings in the problems window (I'm not compiling with GCC and I only use clangd extension)

I'm using CMake with clang to compile. I'm using only the clangd VSCode extension (i.e., not using any other C++ extensions). In the "Problems" window, which is powered by VSCode and not compiler output (so there's not an issue with my CMake stuff…
user5406764
  • 1,627
  • 2
  • 16
  • 23
3
votes
1 answer

vscode-clangd with .inl files

I know there are many questions about this but non seem to be what I need or are not clear enough. I'm using visual studio code for my c++ project. At first I was using intellisense which worked fine except for the fact that I was missing the call…
C. Binair
  • 419
  • 4
  • 14
3
votes
2 answers

Why does clang give a warning: unterminated ‘#pragma pack (push, …)’ at end of file?

I create a main.cpp in my vscode with clangd enabled, and put the following code in it. clangd warns the first line with the warning message: warning: unterminated ‘#pragma pack (push, …)’ at end of file The whole content of main.cpp: #pragma…
xmllmx
  • 39,765
  • 26
  • 162
  • 323
3
votes
1 answer

Why clangd on windows cannot find standard header files?

I plan to use noevim on windows operation system. I mainly use cpp and i install msys64 to get gcc/g++ compiler, and gcc toolchain is laid on C:\msys64\mingw64\bin directory. I add revelent path to PATH variable. And I wrote a simple hello…
3
votes
1 answer

.clangd: use different compiler flags depending on file extension

I am using the .clangd configuration file to pass compilation flags to clangd. I run clangd on a codebase with C and C++ files. How can I have some flags apply to C++ files but not C files ?
Gabriel Devillers
  • 3,155
  • 2
  • 30
  • 53
3
votes
1 answer

Why is clangd not seeing my custom library location

Problem Statement: I have a library installed in a custom location, and compilation and linkage works properly, but clangd is reporting various errors related to the custom lib. My Makefile has the following flags: CFLAGS += -I/usr/local/share/mylib…
Brett Holman
  • 743
  • 6
  • 18
3
votes
1 answer

How to use clangd text-highlighting with CUDA on header files

I'm running VSCodium with the clangd extension, and I'd like to have proper CUDA highlighting (e.g. __device__ and __host__ keywords are understood). I ran CMake to generate the compile_commands.json file, and it includes CUDA-specific keywords…
Lucas Myers
  • 366
  • 2
  • 13
3
votes
1 answer

Debugging C++ language server errors: Invalid AST

I've got a C++ project in which I can open up any .cpp or .h, and the LSP will crash/fail (I'm using emacs with lsp-mode). For instance if I try to open a file called IDictionary.h, clangd will fail with the following errors in the clangd::stderr…
pipsqueaker117
  • 2,280
  • 9
  • 35
  • 47
3
votes
2 answers

how to add include path for language servers in coc-settings.json file?

I am using neovim plugin "coc-nvim", as the IntelliSense tool for C/C++. as I know this plugin is actually a client of language servers like ccls, clangd and cquery. I have all of these language servers installed on my system and configured them to…
AMIR REZA SADEQI
  • 409
  • 2
  • 5
  • 13
3
votes
0 answers

Clear way to setup LSP (vim-lsc) with vim + CMake?

I am trying to set up LSP with vim + cmake. I am using vim-lsc plugin as client and clangd as the server. Folder structure: Test/ test.cpp test.h CMakeLists.txt test.h: #ifndef TEST_H #define TEST_H class Apple { public: int…
learning2code
  • 460
  • 4
  • 9
3
votes
2 answers

Is it possible to specify the path to the libstdc++ in VS Code clangd extension?

I use VS Code as my main code editor for my C++ development. I am using the remote SSH extension by Microsoft to access my office workstation from home. For the C++ autocompletion and linting I use the clangd extension by LLVM. Company policy…
antogilbert
  • 176
  • 2
  • 12
3
votes
1 answer

redirect clangd stderr to a file instead of console

clangd writes log messages to stderr. In Linux, I need it to redirect stderr to a log file for future use, instead of console the command I used is: clangd --clang-tidy -compile-commands-dir=$SOME_PATH --log=error > $SOME_PATH/clangd.log 2>&1 It…
Sonic Ning
  • 61
  • 8
3
votes
1 answer

How to change the path of precompiled header file of clang

By default, it seems clangd creates pch files in system temporary path, i.e. /tmp/*.pch. What if I want to change it to a different location? I don't see clangd has any command line option for that. Any ideas? clangd -pch-storage=disk
solotim
  • 1,826
  • 4
  • 24
  • 41
2
votes
2 answers

How to display "Problems" only for the code I changed/added in Visual Studio Code?

After 3 years on VS, I decided to try Visual Code with clangd for a bit. I work for a big company with huge legacy code and technical debt so I often have to work with some old code and not so modern C++ and more often than not I must read a lot of…
Krustibat
  • 81
  • 5
1
2
3
10 11