How : Language Server Clang && C++ 17

General questions regarding the usage of CodeLite
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How : Language Server Clang && C++ 17

Post by eranif »

The completion you are getting are not coming from clangd. These are coming from the builtin parser. I can see that because of the side window which is displayed to the right of the completion box (its content is not coming from clangd)
Because you lowered the priority of clangd to 40, you have 2 completion engines working, the default '90' would only keep clangd running - and in your case, no completion at all :/

To further debug what is wrong, I would suggest focus on the changes between my environment and yours:
I use MinGW 8.2 while you are using MinGW 9.3 (which I was not aware that it was released for *native* MinGW, i.e. non msys)

So, enable CodeLite log from: Settings -> preferences -> misc ->log -> log file verbosity -> Debug

Now you should have a log file under:
%APPDATA%\CodeLite\codelite.log


Attempt to code complete again and paste here the log output
Make sure you have read the HOW TO POST thread
seregads
CodeLite Enthusiast
Posts: 15
Joined: Thu Apr 02, 2020 6:17 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How : Language Server Clang && C++ 17

Post by seregads »

Im not sure that it is not from a clang..
I change priority to >100, and nothing new...
When i disable langserver, i have i nice view :) (see Annotation 2020-04-25 233242.png), but when clangd is enabled, it show me error as my previous posts...
Log in attach.
You do not have the required permissions to view the files attached to this post.
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How : Language Server Clang && C++ 17

Post by eranif »

the one that gives you the "view" is not clangd.
Have you tried switching compilers as I suggested?
Make sure you have read the HOW TO POST thread
seregads
CodeLite Enthusiast
Posts: 15
Joined: Thu Apr 02, 2020 6:17 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How : Language Server Clang && C++ 17

Post by seregads »

tried to use other mingw from here : http://msystem.waw.pl/x265 :

binutils 2.34
gcc 8.4 (gmp 6.2.0, mpfr 4.0.2-p1, mpc 1.1.0, isl 0.22.1)
mingw-w64 [78276d] 20200311
gdb 9.1
make 4.2.1
zlib 1.2.11
build script [r421] + '--disable-shared --enable-fully-dynamic-string' https://sourceforge.net/projects/mingw-w64-dgn/

compile_flags.txt:
-Ic:\mingw_84_x64\include\c++\8.4.0
-Ic:\mingw_84_x64\include\c++\8.4.0\x86_64-w64-mingw32
-Ic:\mingw_84_x64\include\c++\8.4.0\backward
-Ic:\mingw_84_x64\lib\gcc\x86_64-w64-mingw32\8.4.0\include
-Ic:\mingw_84_x64\lib\gcc\x86_64-w64-mingw32\8.4.0\include-fixed
-Ic:\mingw_84_x64\x86_64-w64-mingw32\include
-ID:\IAP20\calc_kernel\IAP_DLL
-ID:\IAP20\calc_kernel\Projects\MARS
-std=c++17
-target
x86_64-pc-windows-gnu
You do not have the required permissions to view the files attached to this post.
seregads
CodeLite Enthusiast
Posts: 15
Joined: Thu Apr 02, 2020 6:17 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How : Language Server Clang && C++ 17

Post by seregads »

Plugin settings and LOG
You do not have the required permissions to view the files attached to this post.
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How : Language Server Clang && C++ 17

Post by eranif »

From codelite.log:

Code: Select all

I[16:25:24.044] Failed to find compilation database for D:\IAP20\calc_kernel\cpp17.cpp
This error comes from clangd.

This file is located under the "D" drive. I am guessing that your compile_flags.txt is located under a different drive.
The way clangd wrorks:

It searches for compile_flags.txt file under the same location as the file that it tries to compile.
Now, if it does not find compile_flags.txt under this folder, it will go up to the parent folder and so on until it reaches to the root folder.

If this file is located under a different drive it will never find it...
So the question is: is your compile_flags.txt is at the same folder as the source file? (or at least in one of its parent folders)
Make sure you have read the HOW TO POST thread
seregads
CodeLite Enthusiast
Posts: 15
Joined: Thu Apr 02, 2020 6:17 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How : Language Server Clang && C++ 17

Post by seregads »

Yes!
Problem was in project tree...
Its a big project with many folders and files, but compile_flags.txt was present only in one folder, and it wasn't a higher level of hierarchy.
Just copy compile_flags.txt into high project level - and no problem!

Thanks!

P.S.
Is it possible to make name of "compile_flags.txt" as project dependence?
For example, if i have 2 project in the same folder: "d:\Proj\pr1.project" and "d:\Proj\other_proj.project" what will be with "d:\Proj\compile_flags.txt"?
Could do something like that : "d:\Proj\compile_flags_pr1.txt" and "d:\Proj\compile_flags_other_proj.txt"?
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How : Language Server Clang && C++ 17

Post by eranif »

compile_flags.txt is not something that I "invented" - its part of clangd.exe
You can have multiple compile_flags.txt, on under each folder.
The first compile_flags.txt that is found is the one that will be used

read this:

https://releases.llvm.org/8.0.0/tools/c ... ation.html
Make sure you have read the HOW TO POST thread
seregads
CodeLite Enthusiast
Posts: 15
Joined: Thu Apr 02, 2020 6:17 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How : Language Server Clang && C++ 17

Post by seregads »

Ok, i see.

Thanks a lot!
Post Reply