Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Hyena on May 22, 2025, 03:21:48 pm

Title: code completion breaks after changing header file
Post by: Hyena 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.
Title: Re: code completion breaks after changing header file
Post by: Miguel Gimenez on May 22, 2025, 04:03:16 pm
Are you using the legacy code completion plugin (default) or the new Clangd_client (https://wiki.codeblocks.org/index.php/CB_Clangd_Client) plugin?
Title: Re: code completion breaks after changing header file
Post by: Hyena on May 22, 2025, 04:12:46 pm
I haven't changed that, so probably this is the legacy one indeed.
Title: Re: code completion breaks after changing header file
Post by: Hyena 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.

Title: Re: code completion breaks after changing header file
Post by: Pecan 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.

Title: Re: code completion breaks after changing header file
Post by: Hyena 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.
Title: Re: code completion breaks after changing header file
Post by: Pecan 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.

 
Title: Re: code completion breaks after changing header file
Post by: Hyena 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.
Title: Re: code completion breaks after changing header file
Post by: Pecan 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

Title: Re: code completion breaks after changing header file
Post by: Hyena on May 23, 2025, 08:00:57 pm
attached is the requested output. the clang code completion still didn't work.
Title: Re: code completion breaks after changing header file
Post by: Pecan 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.

Title: Re: code completion breaks after changing header file
Post by: Hyena 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
Title: Re: code completion breaks after changing header file
Post by: Pecan on May 24, 2025, 07:36:57 pm
@ Hyena

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

Title: Re: code completion breaks after changing header file
Post by: Hyena 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
Title: Re: code completion breaks after changing header file
Post by: Pecan 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?
Title: Re: code completion breaks after changing header file
Post by: Hyena on May 25, 2025, 07:57:33 am
Did you use the : "./configure --with-contrib-plugins=all" method or did you compile contribs with one of the config .cbp or .workspace files?

I used "./configure --with-contrib-plugins=all" as the BUILD file suggests.
Title: Re: code completion breaks after changing header file
Post by: Pecan on May 25, 2025, 09:40:09 pm
I am not able to re-create the described error.
I believe I have the same environment Monjaro and CodeBlocks build the same as you did.

Do this for me. Right click on the far left log tab named "Code::Blocks" after restarting codeblocks and loading a project.

Right click on the tab, select copy to clipboard paste it in a code tags (the hash mark above a reply block).
I want to compare CB messages with the ones I get.
Title: Re: code completion breaks after changing header file
Post by: Hyena on May 25, 2025, 10:44:22 pm
Code
Loaded config file '/home/hyena/.config/codeblocks/default.conf' (personality: 'default')
Scanning for lexers in /opt/codeblocks/share/codeblocks/lexers/...
Found 62 lexers
Loading lexer_perl
Loading lexer_hitasm
Loading lexer_ruby
Loading lexer_po
Loading lexer_java
Loading lexer_batch
Loading lexer_cg
Loading lexer_vhdl
Loading lexer_OgreMaterial
Loading lexer_prg
Loading lexer_fortran
Loading lexer_pascal
Loading lexer_xml
Loading lexer_ihex
Loading lexer_glsl
Loading lexer_rc
Loading lexer_html
Loading lexer_OgreCompositor
Loading lexer_nsis
Loading lexer_caml
Loading lexer_A68k
Loading lexer_ada
Loading lexer_lisp
Loading lexer_javascript
Loading lexer_latex
Loading lexer_bibtex
Loading lexer_gm
Loading lexer_properties
Loading lexer_masm
Loading lexer_cpp
Loading lexer_python
Loading lexer_powershell
Loading lexer_yaml
Loading lexer_tehex
Loading lexer_objc
Loading lexer_smalltalk
Loading lexer_haskell
Loading lexer_nim
Loading lexer_vbscript
Loading lexer_lua
Loading lexer_cmake
Loading lexer_inno
Loading lexer_cu
Loading lexer_diff
Loading lexer_make
Loading lexer_autotools
Loading lexer_squirrel
Loading lexer_registry
Loading lexer_verilog
Loading lexer_plain
Loading lexer_angelscript
Loading lexer_postscript
Loading lexer_proto
Loading lexer_bash
Loading lexer_markdown
Loading lexer_d
Loading lexer_css
Loading lexer_srec
Loading lexer_sql
Loading lexer_matlab
Loading lexer_coffee
Loading lexer_f77
Configured 0 tools
Scanning for plugins in /home/hyena/.local/share/codeblocks/plugins
Loaded 0 plugins
Scanning for plugins in /opt/codeblocks/lib/codeblocks/plugins
Manager failed to load XRC resource '/opt/codeblocks/share/codeblocks/DisplayEvents.zip'.
Tools Plus Plugin: Registering shell type Piped Process Control
Loaded 59 plugins
Loading:
HelpPlugin
Help plugin ini file: /opt/codeblocks/share/codeblocks/docs/index.ini
SmartIndentXML
cbDragScroll
ReopenEditor
AutoVersioning
wxSmith
wxSmithMime
HeaderFixup
Profiler
HexEditor
ToDoList
Abbreviations
CodeSnippets
CppCheck
cbKeyBinder
wxSmithAui
DisplayEvents
clangd_client
copystrings
EnvVars
Debugger
SmartIndentLua
BYOGames
ThreadSearch
Compiler
BrowseTracker
ClassWizard
OpenFilesList
wxSmithContribItems
RegExTestbed
IncrementalSearch
ProjectsImporter
Cccc
Valgrind
FilesExtensionHandler
SpellChecker
Loading image: '/usr/share/codeblocks/SpellChecker/svg/disabled.svg' failed!
ProjectOptionsManipulator
Exporter
CB_Koders
SmartIndentPython
EditorTweaks
CodeStat
DoxyBlocks
AStylePlugin
SmartIndentHDL
Autosave
ScriptedWizard
OccurrencesHighlighting
SmartIndentFortran
EditorConfig
SmartIndentPascal
SmartIndentCpp
ToolsPlus
NassiShneidermanPlugin
Initial scaling factor is 1.000 (actual: 1.000)
Running startup script
Script plugin registered: Find Broken Files plugin
Script/function 'edit_startup_script.script' registered under menu '&Settings/-Edit startup script'
Opening /home/hyena/Desktop/temp/testcpp/testcpp/testcpp.cbp
Done.
SpellChecker: Thesaurus files '/usr/share/codeblocks/SpellChecker/th_en_US.idx' not found!
ClangdClient: allocating ProxyProject (phase 1).
Opening /home/hyena/.config/codeblocks/CC_ProxyProject.cbp
Done.
ClangdClient: loading ProxyProject (phase 2.
Opening /home/hyena/.config/codeblocks/CC_ProxyProject.cbp
Done.
Title: Re: code completion breaks after changing header file
Post by: Pecan on May 27, 2025, 04:52:04 am
As it turns out, a timeout wxMutex on Manjaro always returns wxMUTEX_MISC_ERROR.

I'm having to change all wxMutex.LockTimeout()s to std::timed_mutex(s) which do work on Manjaro.

This means that any code that was protected by a timed wxMutex never executes.

8>{
Title: Re: code completion breaks after changing header file
Post by: Pecan on May 31, 2025, 09:10:47 pm
@Hyena

Have a look at:
https://github.com/pecanh/Clangd_client/blob/main

And read https://github.com/pecanh/Clangd_client/blob/main/HowToInstall.txt

I updated Clangd_client to accommodate the Manjaro wxMutex problem and tested the install instructions twice.

See if they work for you and let me know of any errors.

Thanks
Title: Re: code completion breaks after changing header file
Post by: Hyena on June 01, 2025, 08:19:57 am
Sorry, that's too much to ask. Perhaps it would make sense to contact Antonio Rojas for this (see screenshot for e-mail). He seems to be responsible for packaging C::B on Manjaro's package manager. The package provided is still at version 20.03 anyway, so pumping it to the newest version might be a good idea.
Title: Re: code completion breaks after changing header file
Post by: Pecan on June 02, 2025, 07:03:56 pm
Fixed svn r13668