0

I am working on a C++ project and have clangd working mostly correctly with a compile_commands.json database generated with CMake.

The problem is that I can't seem to get clangd to work with template header files. Clangd seems to error out with reply:textDocument/semanticTokens/full(2) 736 ms, error: Task was cancelled.\nI[21:36:01.635] --> reply:textDocument/semantcTokens/full(3) 99 ms\n"

I'm using clangd version 15.0.6

I've tried seperating the definition to its own file and including it at the end of the header and the issue persists. I tried looking around and there doesn't seem to be much information related to clangd issues with template header files around, so I'm thinking this might be a bad setup on my end?

Tony Yuen
  • 13
  • 4
  • That error message in the log is expected and harmless. (It basically means "you've edited the file so clangd is not sending a response pertaining to a previous version.") Can you describe what actually goes wrong in terms of editor features, e.g. are you seeing an unexpected diagnostic? And provide a code example? – HighCommander4 Apr 22 '23 at 22:50
  • I'm seeing incorrect error generated by the clangd such as 1. clang: Use of undeclared identifier 'boost' [undeclared_var_use] 2 clang: file not found [pp_file_not_found] 3. clang: Use of undeclared identifier [undeclared_var_use] 4. clang: Unknown type name [unknown_typename] The same include statements and type is recognized in other files. So it seems like clangd is not using the database for this specific file? – Tony Yuen May 15 '23 at 21:03
  • Maybe you are running into https://clangd.llvm.org/faq#how-do-i-fix-errors-i-get-when-opening-headers-outside-of-my-project-directory? – HighCommander4 May 16 '23 at 05:52
  • Otherwise, please show [clangd logs](https://clangd.llvm.org/troubleshooting#gathering-logs) for further diagnosis. – HighCommander4 May 16 '23 at 05:52

0 Answers0