Page 2 of 2

Re: autocomplete is not working

Posted: Tue Apr 27, 2021 10:17 pm
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)


Re: autocomplete is not working

Posted: Fri Apr 30, 2021 5:52 pm
by eranif

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


Re: autocomplete is not working

Posted: Sat May 01, 2021 7:30 pm
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?


Re: autocomplete is not working

Posted: Sat May 01, 2021 7:44 pm
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


Re: autocomplete is not working

Posted: Sun May 02, 2021 12:59 am
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!


Re: autocomplete is not working

Posted: Thu May 20, 2021 11:56 am
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