clang code completion

CodeLite installation/troubleshooting forum
shadoww
CodeLite Enthusiast
Posts: 10
Joined: Fri Mar 23, 2018 7:12 am
Genuine User: Yes
IDE Question: C++
Contact:

clang code completion

Post by shadoww » Sun Jun 16, 2019 3:37 am

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.

DavidGH
CodeLite Plugin
Posts: 583
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: clang code completion

Post by DavidGH » Sun Jun 16, 2019 11:11 am

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

shadoww
CodeLite Enthusiast
Posts: 10
Joined: Fri Mar 23, 2018 7:12 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: clang code completion

Post by shadoww » Mon Jun 17, 2019 1:08 am

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.

shadoww
CodeLite Enthusiast
Posts: 10
Joined: Fri Mar 23, 2018 7:12 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: clang code completion

Post by shadoww » Mon Jun 17, 2019 4:55 am

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?

User avatar
eranif
CodeLite Plugin
Posts: 5934
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: clang code completion

Post by eranif » Mon Jun 17, 2019 2:45 pm

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
Make sure you have read the HOW TO POST thread

shadoww
CodeLite Enthusiast
Posts: 10
Joined: Fri Mar 23, 2018 7:12 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: clang code completion

Post by shadoww » Tue Jun 18, 2019 7:37 am

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.

User avatar
eranif
CodeLite Plugin
Posts: 5934
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: clang code completion

Post by eranif » Tue Jun 18, 2019 8:09 pm

Thanks, I am happy you like it :)
Make sure you have read the HOW TO POST thread

Post Reply