autocomplete is not working

CodeLite installation/troubleshooting forum
evstevemd
CodeLite Guru
Posts: 352
Joined: Sun Nov 29, 2009 7:36 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: autocomplete is not working

Post by evstevemd »

eranif wrote: Tue Apr 27, 2021 8:50 pm

You did not answer my initial question:
which workspace type are you using?

Sorry I missed this. Normal C++ workspace that I created with 14.x (Probably earlier version)

CodeLite 15.x
CodeLite is awesome, I just Love it!

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

Re: autocomplete is not working

Post by eranif »

But you mentioned "CMake generated folder"
Is this a custom build project?
can you paste here the build output?

Make sure you have read the HOW TO POST thread
evstevemd
CodeLite Guru
Posts: 352
Joined: Sun Nov 29, 2009 7:36 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: autocomplete is not working

Post by evstevemd »

Hi,

eranif wrote: Fri Apr 30, 2021 5:52 pm

But you mentioned "CMake generated folder"
Is this a custom build project?
can you paste here the build output?

OK so here is how I generated the whole thing.
I created C++ project with CMake as generator
CL generated for me relevant CMake files
I removed comments so that CL does not autogenerate CMake files (.*tx) because I did a lot of hand editing.

I'm not sure that fits the definition of Custom.
But may be I removed some important CMake instructions related to Autocomplete?

CodeLite 15.x
CodeLite is awesome, I just Love it!

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

Re: autocomplete is not working

Post by eranif »

When using CMake plugin, the default Makefile generators are not working, this means, that the mention files are not created by CodeLite. It is custom in the meaning that CodeLite does not generate the Makefiles.

Somewhere at the top of your main CMakeLists.txt make sure that this line exists:

Code: Select all

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

and somewhere at the bottom of the same CMakeLists.txt, have this:

Code: Select all

execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json 
                ${CMAKE_SOURCE_DIR}/compile_commands.json)

The first command, tells CMake to generate compile_commands.json, the problem is that this file is generated at the build folder (e.g. build-debug)
the second commands, adds a symlink from the source directory to the generate compile_commands.json file so clangd is able to pick it up

Make sure you have read the HOW TO POST thread
evstevemd
CodeLite Guru
Posts: 352
Joined: Sun Nov 29, 2009 7:36 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: autocomplete is not working

Post by evstevemd »

I have done that and now the JSON file is generated. Completion still not working though.
I will review the log and see if there is anything I can fix there!

CodeLite 15.x
CodeLite is awesome, I just Love it!

evstevemd
CodeLite Guru
Posts: 352
Joined: Sun Nov 29, 2009 7:36 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: autocomplete is not working

Post by evstevemd »

Hi Eran,
Today I got time to play around and go deeper into logs.
After some tests and observing the changes in the log, I can confirm that LS still cannot find headers with the same message coming off diagnostics ("wx/xxxx.h not found)

Can it be because of missing compile_flags.txt? How can I tell CL to generate that file?

Thank you

CodeLite 15.x
CodeLite is awesome, I just Love it!

Post Reply