Author Topic: Code completion issues : Nightly build 13231  (Read 5802 times)

Offline draughlin

  • Multiple posting newcomer
  • *
  • Posts: 12
Code completion issues : Nightly build 13231
« on: April 04, 2023, 06:16:46 am »
Hi,
I have the following simple C++ project with the following code, which compiles successfully (, that's not the problem.) The problem is that code completion does not work for any members of 'myHouses' derived from struct House. I am using nightly build 13231. Any help would be greatly appreciated. The code below is just a small excerpt to demonstrate the problem. Its not just this code that the code completion does not work with. BTW I am using cbLauncher.exe to launch codeblocks as I like to use it "portably." Also using Windows 11 22H2 build 22621.1413

#include <iostream>
#include <vector>

struct House
{
    int number {};
    int numberRooms {};
};

int main()
{
    std::vector<House> myHouses {};
    myHouses = { { {1,2 }, {3, 4}, {5, 6} } };
    myHouses[0].number = 99;
    std::cout << myHouses[0].number
}
« Last Edit: April 04, 2023, 06:24:48 am by draughlin »

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Code completion issues : Nightly build 13231
« Reply #1 on: April 04, 2023, 10:38:19 am »
Are you using the original plugin or the clangd one?. The latter should work.

Offline draughlin

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Code completion issues : Nightly build 13231
« Reply #2 on: April 04, 2023, 10:42:27 am »
Hi, thanks for your reply. I am using whatever one comes by default out of the box as it were. How do I go about using the Clangd version?

<edit>
Ok, so I go to Plugins menu and select Manage plugins. I select Code completion and Disable it. I select Clangd_client and enable it.
Then I exit codeblocks. Then I launch codeblocks again, go to plugins menu and see that Clangd_Client is DISABLED why?
I re ENABLE it, and exit codeblocks again. I launch codeblocks again, go to plugins menu and see that Clangd_Client is still DISABLED.
Dont know what to do from here. Any help would be appreciated.
« Last Edit: April 04, 2023, 11:25:31 am by draughlin »

Offline draughlin

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Code completion issues : Nightly build 13231
« Reply #3 on: April 04, 2023, 11:40:58 am »
Hi All,
Ok, managed to successfully ENABLE the Clangd_Client in the plugin manager. Now I go to Settings/Editor but there is no Clangd_client anywhere in the scrolling section on the left of the window.
Any help much appreciated.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: Code completion issues : Nightly build 13231
« Reply #4 on: April 04, 2023, 03:21:16 pm »
I have never used it, but there are comprehensive instructions in the Wiki.

Offline draughlin

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Code completion issues : Nightly build 13231
« Reply #5 on: April 05, 2023, 01:19:57 am »
Hi!
I have followed the wiki to get this far. However in Settings/Editor but there is no Clangd_client anywhere in the scrolling section on the left of the window.

Offline draughlin

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Code completion issues : Nightly build 13231
« Reply #6 on: April 05, 2023, 01:36:26 am »
Ok,
Managed to get further. What the Wiki does not say is that you have to set your default compiler to be LLVM/Clang. Once you do this, you will find the Clangd_client under settings/editor. I am using LLVM/Clang 16.0
I have configured the clangd_client to use the correct clangd.exe executable but now it continually complains about not being able to find a clangd installation, even though I have manually browsed to the clangd.exe and selected it. Please see attached image of error. Do I need to use an older version of LLVM/Clang perhaps?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Code completion issues : Nightly build 13231
« Reply #7 on: April 05, 2023, 02:26:15 am »
https://wiki.codeblocks.org/index.php/CB_Clangd_Client

Link to directions; I have not used these directions or this plugin so can not help.

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 draughlin

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Code completion issues : Nightly build 13231
« Reply #8 on: April 05, 2023, 02:56:05 am »
Thanks Tim,
Those are indeed the instructions that I have been following.
One problem seems to be launching codeblocks from cblauncher. If you do this then when you enable the clangd_client it does not stay enabled.
Second problem the clangd_client plugin seems to be incompatible with LLVM/Clang 16. It continually complains with the above error (see attachment.) It works fine with LLVM/Clang 13.0.1. I will test it with later versions if I have time.

Offline draughlin

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Code completion issues : Nightly build 13231
« Reply #9 on: April 05, 2023, 03:10:16 am »
Ok, Here is what I have found.
(1) Dont use the cblauncher.exe to launch codeblocks - if you do then you will not be able to permanently ENABLE the Clangd_client.
(1A) Sometimes you might need to delete your codeblocks settings in %APPDATA%\roaming to get it to ENABLE.
(1B) If you are using cblauncher.exe you will need to delete your local AppData directory to get it to ENABLE.
(2) The Clangd_client is incompatible with LLVM/Clang 16. It works fine with LLVM/Clang versions 13.0.1 to 15.0.7
(3) The Clangd_client does not autocomplete header file names (e.g. <algorithm> )
Hope this will help some poor sucker in the future.
Thanks for the help,
Greg.
« Last Edit: April 05, 2023, 03:36:58 am by draughlin »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: Code completion issues : Nightly build 13231
« Reply #10 on: April 05, 2023, 06:41:41 am »
Ok, Here is what I have found.
(1) Dont use the cblauncher.exe to launch codeblocks - if you do then you will not be able to permanently ENABLE the Clangd_client.
(1A) Sometimes you might need to delete your codeblocks settings in %APPDATA%\roaming to get it to ENABLE.
(1B) If you are using cblauncher.exe you will need to delete your local AppData directory to get it to ENABLE.
(2) The Clangd_client is incompatible with LLVM/Clang 16. It works fine with LLVM/Clang versions 13.0.1 to 15.0.7
(3) The Clangd_client does not autocomplete header file names (e.g. <algorithm> )
Hope this will help some poor sucker in the future.
Thanks for the help,
Greg.

Sorry that you had to go through that grief.
Indeed, the Clangd_client has problems finding the version 16.0 resources to run.
This problem has been fixed for the next nightly.

I have never used the cblauncher, but I'll have a look at the problem if you'll give me a 1,2,3 step type discription of how to re-recreate the problem.

Thanks for reporting.

Offline draughlin

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Code completion issues : Nightly build 13231
« Reply #11 on: April 05, 2023, 09:59:25 am »
Hi Pecan!

Firstly, let me say what a great plugin clangd_client is. It does exactly what I need it to do. I only wish it autocompleted header file names ;)
I just love using codeblocks, and was not looking forward to going back to visual studio, visual studio code & Xcode. I use codeblocks on Windows, Linux and MacOS and it usually works just great!
A huge thumbs up from me to all the dedicated developers and testers ;D
« Last Edit: April 05, 2023, 10:04:15 am by draughlin »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Code completion issues : Nightly build 13231
« Reply #12 on: April 05, 2023, 04:10:13 pm »
Ok, Here is what I have found.
(1) Dont use the cblauncher.exe to launch codeblocks - if you do then you will not be able to permanently ENABLE the Clangd_client.
(1A) Sometimes you might need to delete your codeblocks settings in %APPDATA%\roaming to get it to ENABLE.
(1B) If you are using cblauncher.exe you will need to delete your local AppData directory to get it to ENABLE.
(2) The Clangd_client is incompatible with LLVM/Clang 16. It works fine with LLVM/Clang versions 13.0.1 to 15.0.7
(3) The Clangd_client does not autocomplete header file names (e.g. <algorithm> )
Hope this will help some poor sucker in the future.
Thanks for the help,
Greg.

I use cblauncher.exe everyday and I don't see such kinds of issue.

My guess is that when you double click on a ".cbp" file, you have codeblocks.exe launched, not the cblauncher.exe. In this case, codeblocks.exe still use the settings under  the %APPDATA% folder.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Code completion issues : Nightly build 13231
« Reply #13 on: April 05, 2023, 08:37:03 pm »
I will try tomorrow to have a new nightly which will contain the clang 16 fix.

Offline draughlin

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Code completion issues : Nightly build 13231
« Reply #14 on: April 06, 2023, 12:21:15 am »
Hi,
I dont double click on .cbp file.
I always use cblauncher directly.
I use cblauncher everyday too.