Menu

#1350 code completion not working properly with namespaces

Undefined
wont-fix
pecan
Bug_Report
2023-10-17
2022-12-29
Elena
No

Using cb svn12990 (win7 64). Code completion does not work well. In my project I have a Header declaring some functions scoped under ed::esd.
Eg. in ed_esd.h
namespace ed::esd
{
void myFunc(int a, float b);
}

In my source cpp I have

include "ed_esd.h"

using namespace ed::esd;

  1. If I start typing myFunc( ... I get no completion (evidently the cc is not smart enough to detect the using namespace directive ?)
  2. This is imho a bug: if I start typing ed::myFunc( ...... I get the popup window with the hints. But not so if I type ed::esd::myFunc(.... but myFunc() is scoped as ed::esd, not as ed:: !!

Thanks

Discussion

  • Elena

    Elena - 2023-01-13

    Nobody ?

     
  • ollydbg

    ollydbg - 2023-01-13

    Hi, currently, we have two code completion plugin in codeblocks.

    The first one is called code completion plugin, I think you are using this. The second one is called clangd_client plugin.

    I'm not sure, can you try the nightly build version of C::B, and enable the second one. This one is using the clangd as the LSP(language server), I think it will solve your problem.

     
  • Elena

    Elena - 2023-01-17

    Hi, I updated to the latest NB but I have no luck enabling the clang client plugin. I tried 10 times in vain, saved, closed CB, reopened... when I try to enable it I get a banner saying Clang client is inactive, to run clangd client restart codeblocks after setting a compiler and disabling the code completion plugin. I have disabled it of course but I am not going to mess up with my compiler settings because I risk to ruin my projects and compiler setup. What can I do to enable this plugin ? To me it sounds very strange that enabling it must be so difficult... giving up sorry

    Anyway, I think the issue I reported with the default code completion plugin is serious enoigh and should be fixed

     
  • MaxGaspa

    MaxGaspa - 2023-01-27

    I think is a very old issue of the plugin. Try to use in the .cpp file something like

    namespace foo
    {
    ....
    }

    instad of using

    using namespace foo

    Anyway in my opinion the new clangd_client is excellent and is improving day after day. Have you installed the reuquired clangd package? The NB alone is not enough.

    Please verify whether in Setting-Editor-Clangd_client and in the tab "c/c++ parser" the "executable to use" is correctly set. Try the autodetect button.

    Hope this helps

     
  • pecan

    pecan - 2023-10-16
    • labels: --> CodeCompletion
    • status: open --> wont-fix
    • assigned_to: pecan
    • Type: Undefined --> Bug_Report
     
  • pecan

    pecan - 2023-10-16

    I'm going to close this bug report because it's unlikely anyone dares to attempt fixing the legacy CodeCompletion plugin and so many fixes have been applied to the newer Clangd_client plugin that Elena should really try it out to solve the reported problem.

     
  • Elena

    Elena - 2023-10-16

    There is no problem for me. I'd be glad to use the clangd client instead but I encountered some difficulty with activating it and I didn't get much support on the forum, nor I can invest too much time for it now (otherwise I should suspend all my ongoing coding works aarghh) That was just to say I'm far from using outdated stuff at any cost and for no reason ;)

     
    • pecan

      pecan - 2023-10-17

      Sorry, I didn't mean to leave you hanging when you're have problems activating Clangd_client.
      Here's a url showing how to install it.
      https://wiki.codeblocks.org/index.php/CB_Clangd_Client

      Please post a reply to the forum section
      https://forums.codeblocks.org/index.php/topic,24357.0.html
      Saying that you have a problem activating Clangd_client.
      Tell us
      1) Your operation system
      2) The version of CB you're using
      3) The problem you had when attempting to activate Clangd_client

      I will be happy to help and give explicit steps once I know your environment.
      Thanks for your patience.
      pecan

       

Log in to post a comment.