Author Topic: code completion breaks after changing header file  (Read 4263 times)

Offline Hyena

  • Multiple posting newcomer
  • *
  • Posts: 32
code completion breaks after changing header file
« on: May 22, 2025, 03:21:48 pm »
When I change a structure declaration in one of the header files, then afterwards in the C source files the code will no longer be able to complete anything. A note appears saying that parser is still parsing the files, but it never completes. The only way to fix it is by restarting codeblocks. This happens even if the change to the header file does not functionally change anything (just by adding a space to the end of an empty line and saving the header file will break code completion). The problem is with both the 20.03 and the SVN versions of codeblocks.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1723
Re: code completion breaks after changing header file
« Reply #1 on: May 22, 2025, 04:03:16 pm »
Are you using the legacy code completion plugin (default) or the new Clangd_client plugin?

Offline Hyena

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: code completion breaks after changing header file
« Reply #2 on: May 22, 2025, 04:12:46 pm »
I haven't changed that, so probably this is the legacy one indeed.

Offline Hyena

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: code completion breaks after changing header file
« Reply #3 on: May 22, 2025, 04:21:46 pm »
I disabled the legacy and enabled the clang one but the clang didn't work at all. Also another thing I noticed was that anonymous structs seem to be confusing the code completion. In the added screenshots only one "capacity" should appear, but instead I get multiple because other sub structures have the same variable.


Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2872
Re: code completion breaks after changing header file
« Reply #4 on: May 22, 2025, 07:56:21 pm »
@Hyena

This usually happens when the wrong clangd.exe is being used.
Please look at MainMenu/settings/editor/clangd_client/tab C/C++ parser and telll us the path of the clangd that you are using.


Offline Hyena

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: code completion breaks after changing header file
« Reply #5 on: May 22, 2025, 08:52:49 pm »
everything seems fine here. when I start the project it initially says in the bottom right corner that parsing is paused. then I toggle it by right clicking on the project name, but still autocomplete doesn't work.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2872
Re: code completion breaks after changing header file
« Reply #6 on: May 23, 2025, 07:16:07 am »
@ Hyena

Please start your CodeBlocks with the /d parameter so that it shows the
Codeblocks debug tab.

Load the project giving you the problem, then after the problem occurs, right click on the "Code::Blocks debug" tab and chose "copy to contents to clipboard".

Paste that into a txt file, zip it up and append it to a message to us so we can try to get a clearer picture of the problem.

 

Offline Hyena

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: code completion breaks after changing header file
« Reply #7 on: May 23, 2025, 11:31:38 am »
unfortunately I wasn't able to locate the "code::blocks debug" tab anywhere. I did attach the console output of it though.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2872
Re: code completion breaks after changing header file
« Reply #8 on: May 23, 2025, 06:47:11 pm »
I'm guessing that one of those enabled plugins is not passing events along to other plugins because Clangd_client isn't even starting up or initializing.

The log also shows that Clangd_client AND Codecompletion plugins are being loaded. That should not happen.

Please disable all plugins marked with a 'd' in the following list, run codeblocks again, and attach the resulting log again.

Thanks.

Code
	HelpPlugin: loaded
SmartIndentXML: loaded
d rndgen: loaded
cbDragScroll: loaded
ReopenEditor: loaded
d MouseSap: loaded
d CodeCompletion: loaded
d Cscope: loaded
d SymTab: loaded
d lib_finder: loaded
AutoVersioning: loaded
wxSmith: loaded
wxSmithMime: loaded
d HeaderFixup: loaded
d Profiler: loaded
d HexEditor: loaded
ToDoList: loaded
Abbreviations: loaded
d CodeSnippets: loaded
d CppCheck: loaded
cbKeyBinder: loaded
wxSmithAui: loaded
d DisplayEvents: loaded
clangd_client: loaded
d copystrings: loaded
d EnvVars: loaded
Debugger: loaded
d SmartIndentLua: loaded
d BYOGames: loaded
ThreadSearch: loaded
Compiler: loaded
BrowseTracker: loaded
ClassWizard: loaded
OpenFilesList: loaded
d wxSmithContribItems: loaded
d RegExTestbed: loaded
IncrementalSearch: loaded
ProjectsImporter: loaded
d Cccc: loaded
d Valgrind: loaded
FilesExtensionHandler: loaded
d SpellChecker: loaded
d ProjectOptionsManipulator: loaded
d Exporter: loaded
d CB_Koders: loaded
d SmartIndentPython: loaded
d EditorTweaks: loaded
d CodeStat: loaded
DoxyBlocks: loaded
AStylePlugin: loaded
d SmartIndentHDL: loaded
Autosave: loaded
ScriptedWizard: loaded
OccurrencesHighlighting: loaded
d SmartIndentFortran: loaded
EditorConfig: loaded
SmartIndentPascal: loaded
SmartIndentCpp: loaded
ToolsPlus: loaded
NassiShneidermanPlugin: loaded

« Last Edit: May 23, 2025, 06:51:26 pm by Pecan »

Offline Hyena

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: code completion breaks after changing header file
« Reply #9 on: May 23, 2025, 08:00:57 pm »
attached is the requested output. the clang code completion still didn't work.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2872
Re: code completion breaks after changing header file
« Reply #10 on: May 24, 2025, 05:28:38 pm »
@ Hyena

On what version of Linux are you running CodeBlocks?

Where did you get your version of codeblocks and how did you install it.

I'd like to try to re-create this situation by installing the same CB you're now running.

« Last Edit: May 24, 2025, 05:47:51 pm by Pecan »

Offline Hyena

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: code completion breaks after changing header file
« Reply #11 on: May 24, 2025, 06:03:46 pm »
here's a screenshot of my system info

I installed CB according to this manual: https://wiki.codeblocks.org/index.php/Installing_Code::Blocks_from_source_on_Linux

I downloaded the source code from SVN and installed it according to Unix build/install instructions in the BUILD file

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2872
Re: code completion breaks after changing header file
« Reply #12 on: May 24, 2025, 07:36:57 pm »
@ Hyena

Please show me the results of:
g++ --version
clangd --version
wx-config --cxxflags


Offline Hyena

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: code completion breaks after changing header file
« Reply #13 on: May 24, 2025, 07:46:14 pm »
[hyena@Courage livonia]$ g++ --version
g++ (GCC) 15.1.1 20250425
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[hyena@Courage livonia]$ clangd --version
clangd version 19.1.7
Features: linux
Platform: x86_64-pc-linux-gnu

[hyena@Courage livonia]$ wx-config --cxxflags
-I/usr/lib/wx/include/gtk3-unicode-3.2 -I/usr/include/wx-3.2 -DWXUSINGDLL -D__WXGTK3__ -D__WXGTK__ -D_FILE_OFFSET_BITS=64

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2872
Re: code completion breaks after changing header file
« Reply #14 on: May 25, 2025, 02:02:46 am »
@ Hyena

I now have Codeblocks compiled and running on Monjaro.
But the default make file only creates the base plugins. Not clangd_client or any other contrib plugin.

So tell me how you compiled and installed all those contrib plugins so that I can do it exactly like you did.

I'm trying to get on the "same page" you are on to try and re-create the problem with Clangd_client.

Did you use the : "./configure --with-contrib-plugins=all" method or did you compile contribs with one of the config .cbp or .workspace files?
« Last Edit: May 25, 2025, 02:30:48 am by Pecan »