Page 1 of 1

clang code completion

Posted: Sun Jun 16, 2019 3:37 am
by shadoww
I switched to Manjaro and noticed that the clang tab is gone in codelite version 12 and 13 for code completion. I looked at the build file and it appears to be enabled but I don't see a tab for it in the code completion setup screen. is this by design or Am i missing something. I have clang 8 installed currently with gcc 8.

Re: clang code completion

Posted: Sun Jun 16, 2019 11:11 am
by DavidGH
Hi,

A new feature in CL 13 is Language Server support, which replaces clang code-completion. You can switch it on from Plugins > Language Server > Settings.

Regards,

David

Re: clang code completion

Posted: Mon Jun 17, 2019 1:08 am
by shadoww
Thanks! That worked. I configured it as follows:

Name: Clang
Executable: clangd
Arguments:
Working Directory:
Languages: c;cpp
Connection String: stdio
Priority: 75
Checked Display Diagnostics

The entries that I didn't specify anything for I left blank. It seems to work for my 5 second test. If there is another way to configure this please let me know.

Re: clang code completion

Posted: Mon Jun 17, 2019 4:55 am
by shadoww
Another question: There used to be a clang build tab that would display errors from the parser. Was that removed or is there another way to bring it up? If there is no tab then how do we see errors from clang if using another compiler for building?

Re: clang code completion

Posted: Mon Jun 17, 2019 2:45 pm
by eranif
Yes, the clang tab was removed as well.
When you get errors from clangd, they will be shown as red markers next to the text.
You can check that is enabled under: Plugins->Language Server->Settings->Clang tab->Display diagnostics

One caveat about clangd code completion:
You might not get code completion for header files, this is because .h files are recognised as C header files and not as C++ header files.
This seems to be a bug in clangd implementation. The only thing that got the code completion from clangd to work on header file was to rename it to .hpp

Re: clang code completion

Posted: Tue Jun 18, 2019 7:37 am
by shadoww
I finally got to some coding and the new clang feature is great! It tells you what the wrong as you are coding like in Visual Studio or QTCreator. Just make sure to save for it to update.

Re: clang code completion

Posted: Tue Jun 18, 2019 8:09 pm
by eranif
Thanks, I am happy you like it :)