Author Topic: Code completion doesn't show up for some wxWidgets  (Read 4775 times)

Offline Dibo

  • Single posting newcomer
  • *
  • Posts: 5
Code completion doesn't show up for some wxWidgets
« on: March 06, 2025, 07:50:38 pm »
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.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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7773
    • My Best Post
Re: Code completion doesn't show up for some wxWidgets
« Reply #1 on: March 06, 2025, 09:45:46 pm »
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++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Dibo

  • Single posting newcomer
  • *
  • Posts: 5
Re: Code completion doesn't show up for some wxWidgets
« Reply #2 on: March 06, 2025, 10:16:44 pm »
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.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2854
Re: Code completion doesn't show up for some wxWidgets
« Reply #3 on: March 08, 2025, 07:21:53 am »
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

Offline Dibo

  • Single posting newcomer
  • *
  • Posts: 5
Re: Code completion doesn't show up for some wxWidgets
« Reply #4 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 -> )

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2854
Re: Code completion doesn't show up for some wxWidgets
« Reply #5 on: March 09, 2025, 12:54:13 am »
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.
Code
    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.


« Last Edit: March 09, 2025, 01:00:58 am by Pecan »

Offline Dibo

  • Single posting newcomer
  • *
  • Posts: 5
Re: Code completion doesn't show up for some wxWidgets
« Reply #6 on: March 10, 2025, 09:23:49 pm »
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:
Code
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
« Last Edit: March 10, 2025, 09:26:34 pm by Dibo »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2854
Re: Code completion doesn't show up for some wxWidgets
« Reply #7 on: March 11, 2025, 05:52:01 am »
@ 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?

Offline Dibo

  • Single posting newcomer
  • *
  • Posts: 5
Re: Code completion doesn't show up for some wxWidgets
« Reply #8 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

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2854
Re: Code completion doesn't show up for some wxWidgets
« Reply #9 on: March 12, 2025, 02:30:18 am »
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.codeblocks.org/index.php/topic,25970.msg176905.html#msg176905

There are two messages there. The one following the Nightly announcement contains:
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.