News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

code completion breaks after changing header file

Started by Hyena, May 22, 2025, 03:21:48 PM

Previous topic - Next topic

Hyena

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.

Miguel Gimenez

Are you using the legacy code completion plugin (default) or the new Clangd_client plugin?

Hyena

I haven't changed that, so probably this is the legacy one indeed.

Hyena

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.


Pecan

@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.


Hyena

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.

Pecan

@ 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.


Hyena

unfortunately I wasn't able to locate the "code::blocks debug" tab anywhere. I did attach the console output of it though.

Pecan

#8
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.


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


Hyena

attached is the requested output. the clang code completion still didn't work.

Pecan

#10
@ 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.


Hyena

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

Pecan

@ Hyena

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


Hyena

[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

Pecan

#14
@ 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?