Author Topic: Code completion does not parse/move through an entire implentation file  (Read 2919 times)

Offline nore

  • Multiple posting newcomer
  • *
  • Posts: 20
Hi there, I have been experiencing some issues with the Code completion plug-in in the recent weeks. It seems that in one of my implementation files only the constructor is recognized when using CTRL + PgUp/CTRL + PgDn. All other implementation files' and header files' functions can be traversed through using these keys, but I can't seem to discover a reason as to why the implementation file in question cannot be traversed through. I have tried disabling and enabling the plug-in as well as setting the parser to workspace-wide rather than project-wide. I have even tried disabling Smart Sense (what does this do?). If anyone has had a similar problem as this, I would appreciate a point towards solving it!

Thank you,

-nore
« Last Edit: June 22, 2023, 08:53:46 pm by nore »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2723
Hi there, I have been experiencing some issues with the Code completion plug-in in the recent weeks. It seems that in one of my implementation files only the constructor is recognized when using CTRL + PgUp/CTRL + PgDn. All other implementation files' and header files' functions can be traversed through using these keys, but I can't seem to discover a reason as to why the implementation file in question cannot be traversed through. I have tried disabling and enabling the plug-in as well as setting the parser to workspace-wide rather than project-wide. I have even tried disabling Smart Sense (what does this do?). If anyone has had a similar problem as this, I would appreciate a point towards solving it!

Thank you,

-nore

To help, we'll need some information about your environment.
Please tell us your operating system, the version of CodeBlocks you're using, and paste the text of the file your having problems with between code tags (the '#' button above the reply box.

Offline nore

  • Multiple posting newcomer
  • *
  • Posts: 20
Hi there, I have been experiencing some issues with the Code completion plug-in in the recent weeks. It seems that in one of my implementation files only the constructor is recognized when using CTRL + PgUp/CTRL + PgDn. All other implementation files' and header files' functions can be traversed through using these keys, but I can't seem to discover a reason as to why the implementation file in question cannot be traversed through. I have tried disabling and enabling the plug-in as well as setting the parser to workspace-wide rather than project-wide. I have even tried disabling Smart Sense (what does this do?). If anyone has had a similar problem as this, I would appreciate a point towards solving it!

Thank you,

-nore

To help, we'll need some information about your environment.
Please tell us your operating system, the version of CodeBlocks you're using, and paste the text of the file your having problems with between code tags (the '#' button above the reply box.

Hi, thank you for your help. I am on Microsoft Windows 11 and I am using code::blocks svn 13231. I see that the nightly build has been updated--could this be a cause of the issue? I am experiencing the non-parsing issue in a couple implementation files.

For example, in my program I am able to move through functions using CTRL + PgUp and CTRL + PgDn in "MapTileSelect.cpp" and "MapTile.cpp" but not within "MainFrame.cpp" or "VisualGrid.cpp". All headers can be traversed through using Code completion.

EDIT: Updating to svn 13311 did not resolve the issues.
« Last Edit: June 24, 2023, 04:51:58 pm by nore »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2723
When you say that you're using code completion plugin do you mean the older plugin named "code completion" or the newer code completion plugin called "Clangd_client" plugin?

If you're using the older, try using the newer clangd_client plugin.
See https://wiki.codeblocks.org/index.php/CB_Clangd_Client
for directions.

This requires you to install a Clangd.exe process. It's explained in the wiki. I'd suggest using the section entitled " MSYS2 Compiler - MinGW64". For me, I just installed the whole Msys2/Mingw64 system, then told it to install clangd.
It did all the work installing dependencies for me.
 
You'll be happy you did. Msys2/Mingw64 is so useful for so many other windows tools and libs.

Once clangd.exe is installed, go to MainMenu>plugins>Manager plugins. Disable "Code completion" and enable Clangd_client. then restart CodeBlocks. You'll get a message saying you need to tell Clangd client plugin where clangd.exe is. It'll be in the Mingw64/bin/ folder.

If you're already using the newer clangd plugin, would you also upload the .h files so I can try to re-create the problem you described.

The old Code completion plugin is very old and has problems with code using C++11 or higher. Clangd is now used in most modern IDE(s).

Let me know how you progress...
Regards
« Last Edit: June 24, 2023, 06:06:04 pm by Pecan »

Offline nore

  • Multiple posting newcomer
  • *
  • Posts: 20
Ah, that is such a shame as it was working fine only some weeks ago. I do not mind using a newer plug-in; however I am concerned that I do not have a way to install a plug-in without reinstalling code::blocks, no? Is there a way to install this "Clangd" plug-in without a full reinstall?

EDIT: As it turns out the nightly build that I have already includes the Clangd_client plugin. I only need to install the .exe so I may use it.
« Last Edit: June 24, 2023, 07:27:03 pm by nore »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2723
Your svn 13311 also contains it.
It's been a plugin since rev 13027.
You can compile it from the contribs workspace.

Offline nore

  • Multiple posting newcomer
  • *
  • Posts: 20
O.K., I have installed LLVM and pointed the parser at the clangd.exe, but I am getting an error window that tells me that files have not yet been parsed. There is also no toolbar to display the current function as there was with code completion.

I restarted code::blocks and let the parser parse through project files, which took a minute or so; but I do not have a code completion toolbar, and I have many LSP messages telling me of warnings and such. Does the plug-in "expand" with use, i.e. grow to more familiarity with the projects used? I see that it is not very colorful, as Code completion was with its red and green and yellow icons, and there is no toolbar; but perhaps that may be customized?

EDIT: What is Smart Sense?
« Last Edit: June 24, 2023, 11:28:53 pm by nore »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2723
There indeed is a code completion tool bar.

You might be getting incorrect errors from Clangd if you accidently mixed your compiler type and the location you entered for the clangd.exe.

If you are using a Mingw64 compiler, you must use a clangd compiled by Mingw64. If you are using the clang compiler, you must use the clangd.exe that was compile by the clang compiler.


That's why I suggested Msys2/Mingw64. You can ask it to install Clang and/or Mingw64. Each of the separate /bin folders within Mingw64(Msys2) will contain the appropriate clangd.exe.

To display the clangd client toolbar, use MainMenu>View>Toolbars> and click on Clangd client.

Quote
EDIT: What is Smart Sense?
It'll take me some time to figure that out.
For Clangd_client, I think it was a mistake to keep that check box. I don't think it's anything related to Clangd.
« Last Edit: June 25, 2023, 01:21:27 am by Pecan »

Offline nore

  • Multiple posting newcomer
  • *
  • Posts: 20
Incredible, the plug-in works without issue. The toolbar issue is solved and I can traverse through functions in each file. Thank you for your help, Pecan.

EDIT: The only issue I have noticed is that I am receiving "File not yet parsed" messages periodically--usually this occurs after pressing CTRL + S or Building a project.
« Last Edit: June 25, 2023, 03:33:21 am by nore »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2723
Upload those .h files for the example you gave me and let me see if I can reproduce those "not yet parsed" conditions.

For now, when you get those conditions, you can just right click in an empty editor space and choose "Reparse this file". It will place the .h and .cpp file at the head of the queue.

But I suspect, it's related to an included file that's down further in the parse queue. It'd be nice if I could figure out a way to solve this ( if my guess fits reality).

Could also be a speed issue. Please tell me what your cpu is and how many cores/threads it has. You might just be able to tell Clangd client to use more cores. By default it only uses 2; and none during build/rebuild(s).

After I bought my Dell 14 core,24 thread machine, I never saw that message. Guess I'm at a disadvantage.  :D
« Last Edit: June 25, 2023, 07:45:23 am by Pecan »

Offline nore

  • Multiple posting newcomer
  • *
  • Posts: 20
O.K., I suppose speed may be the issue then. I am currently working on a most interesting 2-core Celeron. The issue occurs within an implementation file, not a header file, so I won't pay too much attention to it.