Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Code completion using LSP and clangd
killerbot:
today I tried to activate it on my linux box, I first disabled first the regular code completion plug-in, shutdown CB, started CB, then enabled the clangd based plug-in, which suggest me again to close and restart CB, so I did that.
When CB starts up again, it gives me an informational error message, to set the path of the clangd executable but the moment I open up settings-> Editor CB crashes, and I am never able to set it.
Below a snippet from the crash stack:
<stack>
<frame level="0" function="CodeBlocksApp::OnFatalException()" offset="00000000"/>
<frame level="1"/>
<frame level="2"/>
<frame level="3" function="wxSpinCtrlGTKBase::DoSetValue(double)" offset="00000000"/>
<frame level="4" function="CCOptionsDlg::CCOptionsDlg(wxWindow*, ParseManager*, ClgdCompletion*, DocumentationHelper*)" offset="00000ba0"/>
<frame level="5" function="ClgdCompletion::GetConfigurationPanel(wxWindow*)" offset="0000004b"/>
<frame level="6" function="PluginManager::GetConfigurationPanels(int, wxWindow*, ConfigurationPanelsArray&, cbConfigurationPanelColoursInterface*)" offset="00000165"/>
<frame level="7" function="EditorConfigurationDlg::AddPluginPanels()" offset="00000000"/>
<frame level="8" function="EditorConfigurationDlg::EditorConfigurationDlg(wxWindow*)" offset="00000000"/>
<frame level="9" function="MainFrame::OnSettingsEditor(wxCommandEvent&)" offset="00000000"/>
<frame level="10" function="wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)" offset="0000006e"/>
<frame level="11" function="wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)" offset="00000073"/>
<frame level="12" function="wxEvtHandler::TryHereOnly(wxEvent&)" offset="0000004b"/>
<frame level="13" function="wxEvtHandler::DoTryChain(wxEvent&)" offset="00000043"/>
<frame level="14" function="wxEvtHandler::ProcessEvent(wxEvent&)" offset="00000039"/>
<frame level="15" function="wxWindowBase::TryAfter(wxEvent&)" offset="00000052"/>
<frame level="16" function="wxEvtHandler::SafelyProcessEvent(wxEvent&)" offset="00000007"/>
<frame level="17" function="wxMenuBase::SendEvent(int, int)" offset="0000009b"/>
killerbot:
from the conf file
<clangd_client>
<PARSER_DEFAULTS_CHANGED bool="1" />
<PARSER_FOLLOW_LOCAL_INCLUDES bool="1" />
<PARSER_FOLLOW_GLOBAL_INCLUDES bool="1" />
<WANT_PREPROCESSOR bool="1" />
<PARSE_COMPLEX_MACROS bool="1" />
<PLATFORM_CHECK bool="1" />
<SPLITTER_POS int="250" />
</clangd_client>
maybe I can manually add it here, what's the directive ?
EDIT: added
<LLVM_MASTERPATH>
<str>
<![CDATA[/opt/llvm/bin/clangd]]>
</str>
</LLVM_MASTERPATH>
still crashes as hard
Pecan:
@Killerbot
Tomorrow (dec 13) I'll run through your described steps and see if I can catch the crash. Looks like it might be in a config option I've not tested on linux.
Pecan:
--- Quote from: killerbot on December 11, 2022, 10:52:39 am ---today I tried to activate it on my linux box, I first disabled first the regular code completion plug-in, shutdown CB, started CB, then enabled the clangd based plug-in, which suggest me again to close and restart CB, so I did that.
When CB starts up again, it gives me an informational error message, to set the path of the clangd executable but the moment I open up settings-> Editor CB crashes, and I am never able to set it.
... edited ...
--- End quote ---
@Killerbot
I've tried for many hours to re-create this error on both Linux Mint20.2 and WSL2 with no success.
I've uploaded a video of a Mint20.2 run at
https://www.dropbox.com/s/d6lhsxbzi64x9cr/ClangdClientVideo_221214.zip?dl=0
The zip file contains a .wmv which played on both my windows and Mint systems, but not on my WSL2 (WSL2 requires a whole bunch of additional install fooey).
Note: I used a virgin CB profile (.conf) to do testing, but I only have gtk3 (64bit) to test with. So I couldn't try testing with gtk2.
We might get closer to the error if you would do the following.
Compile clangd_client with -g set to get debug symbols.
Run CB in the debugger and perform the steps you performed to get the error. Then lets have a look at the backtrace.
If debugging is not an option, just copy the -g compiled devel32_64 version of clangd_client dll into your output32_64 plugin folder and perform the steps that caused the error.
You should then get a .rpt file in the output32_64 folder which will have the statement that caused the crash.
Try doing all the above with a virgin personality, eg "run.sh -p virginConf"
If it runs with the virgin conf, we'll know it has something to do with the .conf contents.
In all your spare time :>) you might have a look at:
https://wiki.codeblocks.org/index.php/CB_Clangd_Client
to see if anything was missed there (but I doubt it has anything to do with this crash).
Thanks
Pecan:
--- Quote from: killerbot on December 11, 2022, 10:52:39 am ---today I tried to activate it on my linux box, I first disabled first the regular code completion plug-in, shutdown CB, started CB, then enabled the clangd based plug-in, which suggest me again to close and restart CB, so I did that.
When CB starts up again, it gives me an informational error message, to set the path of the clangd executable but the moment I open up settings-> Editor CB crashes, and I am never able to set it.
Below a snippet from the crash stack:
... snipped ...
--- End quote ---
Finally managed to catch the crash.
Fixed in Head rev 13120.
Thanks
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version