News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Code completion doesn't show up for some wxWidgets

Started by Dibo, March 06, 2025, 07:50:38 PM

Previous topic - Next topic

Dibo

Hi,
I'm newbie in CodeBlocks and wxWidgets. Started writting some app and noticed that some wxWidgets doesn't have code completion, just nothing popup after -> or forced by CTRL+SPACE (sometimes I see hint that parsers is still working). So far these are problematic classes: wxListCtrl and wxSearchCtrl. I have code blocks 20.03+svn13046-0.3build2 (standard installation from Linux Mint repo). Tried everything found by google like disabling SmartSense (this result with hint that result is too big and start typing first letter but nothing happens). Also in C++ parser changed one parser per workspace, didn't help neither. Found also similar issue 10 years ago:
https://forums.next.codeblocks.org/index.php?topic=20175.0

Notice that I have wxWidgets installation in custom folder but CodeBlocks compiler, linker and search directory is configured fine because everything is compiling and debugging works too. Also, code completion for these classes in Visual Studio Code works fine

stahta01

See if the Code::Blocks (CB) you have has the clang based code completion (CC) plugin and if yes maybe someone can tell you what else to install to get it to work. The old CC is not very good, so someone created the new clang LSP based one. The new CC is still lacking a few features of the old CC.

Tim S.

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Dibo

In plugins manager I have this one:

Code completion 1.0
/usr/lib/codeblocks/plugins/libcodecompletion.so
This plugin provides a symbols browser for your projects and code-completion inside the editor.

Pecan

Can you give us some examples or a 1,2,3 type do this then that kind of instructions so we can have something to work with that causes the problem?

Thanks

Dibo

I have prepared and attached simple demo. Created it from wxwidgets template project. You must change compiler settings, linker settings and search directories in debug mode to your own because I have wxwidgets installation in custom home directory. Problematic variables are: mListCtrlSources and thisNOTwork (I already started they with -> )

Pecan

#5
Quote from: Dibo on March 08, 2025, 12:36:55 PM
I have prepared and attached simple demo. Created it from wxwidgets template project. You must change compiler settings, linker settings and search directories in debug mode to your own because I have wxwidgets installation in custom home directory. Problematic variables are: mListCtrlSources and thisNOTwork (I already started they with -> )

Thanks for the example code.
I have verified that the legacy CodeCompletion plugin will not produce completion choices for the code you indicated.

    wxStaticBoxSizer * staticBoxSource = new wxStaticBoxSizer(wxHORIZONTAL, this, "Source dirs && files");
    wxListCtrl* mListCtrlSources = new wxListCtrl(this, -1);
    mListCtrlSources->

... and others ..


In order to produce completions for your code, you will have to use the Clangd_client plugin instead.

Info:
The instuctions for using the Clangd_client language server protocol (LSP):
https://wiki.codeblocks.org/index.php/CB_Clangd_Client

If clangd is already installed on your Linux system, you need only disable the CodeCompletion plugin, enable the Clangd_client plugin, and restart CodeBlocks.

Go to the Settings/Clangd_client/ and enter the address of your Clang executable.



Dibo

Hmm, but in plugins manager I don't have anything like clangd (see attachment). When I click on "Install new" I have file browser filtered by .cbplugin, not .so or executable. Wiki from your link doesn't say anything about cbplugin installation, it expects that clangd plugin already exists and anything what must be done is just enable it
And seems that I have it installed on my linux:

locate clangd

/usr/bin/clangd
/usr/bin/clangd-18
/usr/lib/llvm-18/bin/clangd


Edit: Note that I already have installed codeblocks, codeblocks-common and codeblocks-contrib packages

Pecan

@ Dibo
What version of CodeBlocks are you running.

Did you build it yourself? If so, did you also build the any of the plugins in the Contrib workspace?

Dibo

I have version 20.03+svn13046-0.3build2 from official Linux Mint repo, same version is contrib package

Pecan

Quote from: Dibo on March 11, 2025, 03:32:08 PM
I have version 20.03+svn13046-0.3build2 from official Linux Mint repo, same version is contrib package

Clangd_client plugin was not written to support version 20.03.
However, there are some Nightly builds that contain Clangd_client.
You might have a look at:
https://forums.next.codeblocks.org/index.php/topic,25970.msg176905.html#msg176905

There are two messages there. The one following the Nightly announcement contains:
Quote from: Xaviou on February 23, 2025, 01:01:58 AM
Hi.

32 bits version for Windows can also be can be downloaded from my website.

Debian Bookworm and Bullseye (32 and 64 bits) can be installed from my repo
The corresponding unsigned deb files can also be downloaded from the website page linked above.

Ubuntu-22.04, 24.04 versions can be installed from my ppa

Regards
Xav'

Maybe there is a way to use CodeBlocks from Xaviou's ppa.
I do not know how to do that. I'm not a knowledgeable Linux user.