Hi, Pecan, I see this changes in revision 13432
// Initialized from CodeCompletion constructor
-void CCLogger::Init(wxEvtHandler* parent, int logId, int debugLogId, int addTokenId)
+// ----------------------------------------------------------------------------
+//-void CCLogger::Init(wxEvtHandler* parent, int logId, int debugLogId, int debugLogErrorId, int addTokenId)
+void CCLogger::Init(wxEvtHandler* parent, int logId, int logErrorId, int debugLogId, int debugLogErrorId, int addTokenId)
+// ----------------------------------------------------------------------------
{
m_Parent = parent;
m_LogId = logId;
m_DebugLogId = debugLogId;
+ m_DebugLogErrorId = debugLogErrorId;
m_AddTokenId = addTokenId;
+ m_AddTokenId = addTokenId;
+ m_pCfgMgr = Manager::Get()->GetConfigManager("clangd_client");
+
}
When I try to run the CCTest program, I got an assert failed:
const wxString PersonalityManager::GetPersonality()
{
cbAssert(m_ready);
return m_pers;
}
The issue is that CCTest program has dynamically link to the codeblocks.dll(maybe I need to remove it, but it would be hard such dependency).
So I believe either CCTest code need to initialize some *Manager instance, or the code in the cclogger need to be changed.
But why the "clangd_client" name is in this function call?
Thanks.
EDIT:
m_AddTokenId = addTokenId;
This line is duplicated.
If I remove the line:
diff --git a/src/plugins/codecompletion/parser/cclogger.cpp b/src/plugins/codecompletion/parser/cclogger.cpp
index 65e9d905..31c9d034 100644
--- a/src/plugins/codecompletion/parser/cclogger.cpp
+++ b/src/plugins/codecompletion/parser/cclogger.cpp
@@ -76,7 +76,7 @@ void CCLogger::Init(wxEvtHandler* parent, int logId, int logErrorId, int debugLo
m_DebugLogErrorId = debugLogErrorId;
m_AddTokenId = addTokenId;
m_AddTokenId = addTokenId;
- m_pCfgMgr = Manager::Get()->GetConfigManager("clangd_client");
+ //m_pCfgMgr = Manager::Get()->GetConfigManager("clangd_client");
}
Then I can run the CCTest. Though the CCTest's frame window can be opened, I still can't see the debug log messages in the windows, so there are other issues.
OK, I found a workaround:
diff --git a/src/plugins/codecompletion/cctest/cctest_frame.cpp b/src/plugins/codecompletion/cctest/cctest_frame.cpp
index 32ab3cd0..30fa8ff6 100644
--- a/src/plugins/codecompletion/cctest/cctest_frame.cpp
+++ b/src/plugins/codecompletion/cctest/cctest_frame.cpp
@@ -20,6 +20,8 @@
#include "parsemanager_test.h"
+#include "personalitymanager.h"
+
//(*InternalHeaders(CCTestFrame)
#include <wx/intl.h>
#include <wx/settings.h>
@@ -215,6 +217,8 @@ CCTestFrame::CCTestFrame(const wxString& main_file) :
Connect(wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction)&CCTestFrame::OnMenuAboutSelected);
//*)
+ Manager::Get()->GetPersonalityManager()->MarkAsReady();
+
// redirect the wxLogMessage to the text ctrl of the frame
wxLogTextCtrl* textLog = new wxLogTextCtrl(m_CompletionTestCtrl);
wxLog::SetActiveTarget(textLog);
Hi, I'm currently code-refactoring the legecy codecompletion plugin's tokenizer.
I see one change by you:
- CodeBlocksThreadEvent evt(wxEVT_COMMAND_MENU_SELECTED, m_DebugLogId);
+ bool debugLogging = m_pCfgMgr->ReadBool("/logPluginDebug_check", false);
+ if (not debugLogging and (id==m_DebugLogId)) return;
when the parser finished parsing a project, it normally will print something like: xxxxx tokens and xxxx seconds.
But with this change, I can't see this.
I searched for a while, and I can't find the variable named "/logPluginDebug_check", so what is this purpose of this variable.
For me, I would like to see the debug events from the codecompletion plugin.
Thanks.
@ollydbg
Sorry about this (again).
Please put preprocessor guards around code like that.
I was using it to debug the CodeCompletion plugin and did not consider that it would be used stand-alone.
#if defined(MAKING_PLUGIN)
<the offending code>
#endif
Commit the changes when you are satisfied.
Sorry again.
Hi, Pecan, I think the variable/field name are different?
The code I see is:
// ----------------------------------------------------------------------------
void CCLogger::DebugLog(const wxString& msg, int id)
// ----------------------------------------------------------------------------
{
// Could crash here; should check if shutting down
if (Manager::IsAppShuttingDown())
return;
if (!m_Parent || m_DebugLogId<1) return;
bool debugLogging = false;
if (m_pCfgMgr) debugLogging = m_pCfgMgr->ReadBool("/logPluginDebug_check", false);
if ((not debugLogging) and (id == m_DebugLogId)) return;
Note, the name is "logPluginDebug_check"
But in the CheckBox, the name is "CCDebugLogging".
Are they the same?
When I enabled that CheckBox in the CodeCompletion plugin's setting, I still got the code check "debugLogging" is false.