Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

Code completion using LSP and clangd

<< < (47/92) > >>

Pecan:

--- Quote from: ollydbg on October 28, 2022, 12:40:23 pm ---Hi, Pecan, I try to debug clangd_client, but disable all the other plugins. So I have the patch here:

Re: How to exclude the other plugins when debugging

But when I have only two plugins to load, in the debug-plugin.conf file,
This means only those two dlls get loaded.

But when debugging, I see the debugee codeblocks will report that:

<...some content snipped by pecan...>

The Clangd client plugin cannot run while the "Code completion"
plugin is enabled.


In my plugin management dialog, I have only two plugins, so CodeCompletion plugin is not loaded. I'm not sure why in this case, clangd_client still report the codecompletion is enabled?

Thanks.


EDIT

It looks like the clangd_client has some logic to detect the codecompletion plugin, but the logic is not correct.

Now, I have a workaround, I have change the conf file to have this:

The situation is: if the codecompletion plugin never get loaded, I have no way to enable the clangd_client plugin.  :(

--- End quote ---

I've reworked the code that attempts to avoid running clangd_client when CodeCompletion is enabled.

This situation was caused by:
1) CodeCompletion.dll plugin is missing but the .conf say that it's enabled.
2) CodeCompletion is loaded by PluginManager but there's no info about it in the .conf file.

Hope I've solved these situations in clangd_client repo rev 87.

Pecan:

--- Quote from: ollydbg on October 28, 2022, 03:25:13 pm ---I see another crash caught by GDB.


--- Code: ---From b54738b2d2d2eec2eb7185f14f7c0e1f7c75c68f Mon Sep 17 00:00:00 2001
From: asmwarrior <a@b.com>
Date: Fri, 28 Oct 2022 21:22:01 +0800
Subject: delete the instance first, and later remove it from the list

If first remove from the list, the iterator becomes invalid, remember the pointer before the iterator get destroyed

diff --git a/clangd_client/src/codecompletion/parsemanager.cpp b/clangd_client/src/codecompletion/parsemanager.cpp
index 1590f31..9101ddd 100644
--- a/clangd_client/src/codecompletion/parsemanager.cpp
+++ b/clangd_client/src/codecompletion/parsemanager.cpp
@@ -713,11 +713,12 @@ bool ParseManager::DeleteParser(cbProject* project)
 
         // The logic here is : firstly delete the parser instance, then see whether we need an
         // active parser switch (call SetParser())
-        m_ParserList.erase(parserList_it); //remove deleted parser from parser list
-        delete parserList_it->second;
+        ParserBase* delParser = parserList_it->second;
+        delete parserList_it->second;      // delete the instance first, then remove from the list
+        m_ParserList.erase(parserList_it); // remove deleted parser from parser list
 
         // if the active parser is deleted, set the active parser to nullptr
-        if (parserList_it->second == m_Parser)
+        if (delParser == m_Parser)
         {
             m_Parser = nullptr;
             SetParser(m_TempParser); // Also updates class browser; do not use SetParser(m_TempParser) //(ph 2022/06/6)-


--- End code ---

This will fix the crash.


EDIT:

I updated the patch, because I see the iterator get invalid, so we have to member the pointer address for later comparing.

--- End quote ---

Fix applied in repo rev 87.
Thanks

ollydbg:

--- Quote from: Pecan on October 31, 2022, 07:13:03 pm ---...
I've reworked the code that attempts to avoid running clangd_client when CodeCompletion is enabled.

This situation was caused by:
1) CodeCompletion.dll plugin is missing but the .conf say that it's enabled.
2) CodeCompletion is loaded by PluginManager but there's no info about it in the .conf file.

Hope I've solved these situations in clangd_client repo rev 87.

--- End quote ---

I can confirm this issue is fixed, thanks!

killerbot:
when we activate this new improved way in our nightly builds ?
Is it usable enough (I haven't tried it yet I must admit) to promote to a contrib plug-in ?
I

Pecan:

--- Quote from: killerbot on November 01, 2022, 03:40:19 pm ---when we activate this new improved way in our nightly builds ?
Is it usable enough (I haven't tried it yet I must admit) to promote to a contrib plug-in ?
I

--- End quote ---

I'm comfortable with it now to say that it's ready to be added as a contrib.
I've used it everyday for more than a year.

If/when it become a contrib, it behaves/is guided by the presence of the old CodeCompletion plugin.
1) If CodeCompletion is enabled, Clangd_client disables itself.
2) If CB is a virgin install, and there's no compiler masterpath, Clangd_client disables itself.
3)If CodeCompletion is disabled, Clangd_client can run if the user enables it.
4)If CodeCompletion dll is missing, Clangd_client can run if the user enables it.
5) Otherwise, it remains asleep. waiting for user attention.

All these machinations are done to avoid any conflict with CodeCompletion and to give CodeCompletion priority. It requires the user to specifically take some actions:
1) Disable CodeCompletion and enable Clangd_client.
2) Provide a default compiler.
3) Provide access to a  clang/clangd location (such as llvm or Msys).

I'll provide instructions in the CB wiki regarding it's use and requirements.
Andrew has already provided most of the work for that wiki entry.

But I'd like to hear how other users feel about it becoming a contrib.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version