Recent Posts

Pages: [1] 2 3 4 5 6 ... 10
@bluehazzard I just stumbled onto your page and I will borrow info for the updates on the CB wiki as the pages have allot more info that I was going to put in. Great job. Pitty I did not know about it a year ago as it would have saved me allot of time and head ache, but at least I know about the pages now.
I disagree in that you need to have shown that you are not going to cause havoc and are trying to help with C::B before being "granted" access.
If everyone got access then the bots and people show they have no idea or are not real devs (uni students etc) could cause major issues with regards to reverting their changes if they are bad changes (aka graffiti).
I think every forum user should/could edit the wiki.

I will send an email to our admin for help.
Development / wiki updates - query about backup files for local setup
« Last post by AndrewCot on Today at 04:18:44 am »
Let me know if I am going off on a tangent on this one and wasting my time.
I have been able to download the mediawiki Virtual Machine OVA file from the page below and get it running locally as a VirtualBox guest. This will allow me to learn about the wiki page layout and make changes to locally before requesting changes to the C::B wiki to ensure that the changes work and look okay.  The pages and areas that need updates that I have worked on are:   * Update the Windows build process. Some pages reference wxWidget 3.0 and others 2.8 and references 3.1.4.
   * Create a Unix project/workspace build process, unless there is one that I have not found.
   * Update the Unix makefile process. The has not been touched in a while and is in need of a major rework IMHO.   * Create a page for building the Debian deb packages, unless It is added to the page

VM OVA download page:

But to make the changes without affecting anyone until I submit the changes for approval to be incorporated into the wiki  it looks like I need a backup of the wiki to install it locally. Is there a backup of the wiki available anywhere or can I get a backup of the wiki from someone? If there is another way of doing this that someone has used or knows about that works please let me know. If I am going about this wrong please let me know.
Help / Re: [SOLVED] Squirrel Build Script Syntax Error: expected 'IDENTIFIER'
« Last post by The_GTA on Yesterday at 11:15:21 pm »
I am sorry. (...)

Name             : Code::Blocks
Version          : 20.03-r11997
Don't worry about it. The issue has been solved. You seem to be using an old version of Code::Blocks which does not have the "base" keyword in Squirrel yet.

I find it interesting that you want to investigate the Squirrel VM. To me the CB Squirrel build script system is a great means to fully configure my program building pipeline. It is a novel feature which no other IDE build system has, in that form. Other build systems rely on the terribly antiquated makefile concept which I dislike for it's unhealthy gimmicks (no spaces in paths possible, stuff has to be written in rules, etc). In stark contrast for the Squirrel case, you have got the full freedom of a scripting language which feels really nice. I give the Visual Studio .vcxproj makefile system some slack because it is XML based thus has a really stable format.
Help / Re: Linux allows removal of open files.
« Last post by jordi on Yesterday at 10:01:32 pm »
Help / Re: [SOLVED] Squirrel Build Script Syntax Error: expected 'IDENTIFIER'
« Last post by jordi on Yesterday at 09:51:24 pm »
I am sorry. I don't have any squirrel build script .  Maybe can help you to see the RegisterBinding funcion in scriptingbindings.cpp file.  There are defined all the bindings to: codeblocks code, wxWidgets types, constants, etc
I can try to help you whether you have any doubt. I want to review how squirrel virtual machine works and how bindings are done.

To reproduce the issue I have had to change "base" by "function" as parameter in my system: Debian GNU/Linux 11  (info below):
Then, "base" was not a keyword.  I'll review it

Name             : Code::Blocks
Version          : 20.03-r11997
SDK Version      : 2.0.0
Scintilla Version: 3.7.5
Author           : The Code::Blocks Team
E-mail           :
Website          :

wxWidgets Library (wxGTK port)
Version 3.0.5 (Unicode: wchar_t, debug level: 1),
Runtime version of toolkit used is 3.24.
Compile-time GTK+ version is 3.24.20.
Plugins development / Re: Code completion using LSP and clangd
« Last post by Pecan on Yesterday at 08:54:19 pm »
I see there are some code snippet like:



But in the code, we have to carefully handle the unlocking the wxMutex when return the function body, especially when there are multiply returns.

Is it possible to use the wxMutexLocker, and check the IsOK() function for checking whether it get locked or not.

There are only 2 locks in the code that can cause any trouble. The lock on the input buffer. One to write to the buffer, and one to get the next clangd response out of the buffer. And neither affect the UI thread.

I tried wxMutexLocker first before giving up on it.
I want to be able to unlock the input buffer and then do more work in the function.
When I unlocked the mutex before the function ended,  wxWidgets gave me errors about the mutex. I lost confidence that I could mix a wxMutexLocker and manual unlocks.

In fact, I removed all locks on the main UI thread and used idle time callbacks instead.
Plugins development / Re: Code completion using LSP and clangd
« Last post by Pecan on Yesterday at 08:30:01 pm »
I see there are many pch files in the folder such as:


I think those files is created by clangd, and are there any way to automatically delete them when exit C::B?


clangd writes too much disk : CPP-19402

This discussion looks like the pch can keep in "memory". :)

Here is the patch to fix this pch file issue:

 clangd_client/src/LSPclient/src/client.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/clangd_client/src/LSPclient/src/client.cpp b/clangd_client/src/LSPclient/src/client.cpp
index 88f5f8f..f6b5eb9 100644
--- a/clangd_client/src/LSPclient/src/client.cpp
+++ b/clangd_client/src/LSPclient/src/client.cpp
@@ -266,6 +266,10 @@ ProcessLanguageClient::ProcessLanguageClient(const cbProject* pProject, const ch
     command += " --limit-results=20";              // Limit the number of results returned by clangd. 0 means no limit (default=100)
+    // clangd writes too much disk : CPP-19402
+    // "-pch-storage=memory"
+    command += " -pch-storage=memory";
     if (wxDirExists(clangResourceDir))
         command += " --resource-dir=" + clangResourceDir;  // Directory for system includes

Thanks for that.

I've added code to remove preamble-*.tmp and preamble-*.pch files when the project closes.

I'll later add an option to keep the .pch in memory. (For me, I'd rather keep them on disk and remove them at project close time).

As an aside: Windows does not allow me to remove files that are open and being used. But Linux does. Do you know of a way to tell Linux NOT to allow me to delete open files?
Plugins development / Re: Code completion using LSP and clangd
« Last post by Pecan on Yesterday at 08:23:19 pm »
I see some error message comes from this function call, but I'm not sure why, this happens when I'm editing source file in the C::B editor.

int ProcessLanguageClient::ReadLSPinputLength()
// ----------------------------------------------------------------------------
    // this function is driven by readJson() via the thread in transport::loop()
    // and the incoming data is locked.
    // thread was started in constructor and called from readJason() after locking the buffer

    // "Content-Length: <digits>\r\n\r\n"

    if (Has_LSPServerProcess() and m_std_LSP_IncomingStr.length())
        // search for LSP header
        size_t hdrPosn = m_std_LSP_IncomingStr.find("Content-Length: ");
        if (hdrPosn == std::string::npos)
            return wxNOT_FOUND;
        else //have incoming text
            if (hdrPosn != 0)   // verify LSP header is at beginning of buffer
                // Error: header is not at beginning of buffer. Try to fix it.
                // usually caused by clangd invalid utf8 sequence
                wxString msg(wxString::Format("ERROR:%s(): buffLength (%d): Position of content header %d.\n",
                             __FUNCTION__, int(m_std_LSP_IncomingStr.length()), int(hdrPosn)) );
                msg += "Buffer contents written to client log.";
                #if defined(cb_DEBUG)
                    wxSafeShowMessage("Input Buffer error",msg);
                msg += "LSP_IncomingStrBuf:\n" + m_std_LSP_IncomingStr + "\n";
                // adjust the data buf to get clangd header at buff beginning
                m_std_LSP_IncomingStr = m_std_LSP_IncomingStr.substr(hdrPosn);

I just enabled the log file, and see the log message(in C:\Users\[myusername]\AppData\Local\Temp\CBclangd_client-1332.log

And the content of the log file are:

19:45:09.758 ERROR:ReadLSPinputLength(): buffLength (549): Position of content header 112.
Buffer contents written to client log.LSP_IncomingStrBuf:
":{"newText":"wxConvAuto($0)","range":{"end":{"character":16,"line":94},"start":{"character":12,"line":94}}}}]}}Content-Length: 414

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"category":"Parse Issue","code":"expected_unqualified_id","codeActions":[],"message":"Expected unqualified-id","range":{"end":{"character":14,"line":97},"start":{"character":12,"line":97}},"relatedInformation":[],"severity":1,"source":"clang"}],"uri":"file:///F:/test/Config.cpp","version":1}}

This is caused by clangd sending a message (usually a code completion response) with an illegal utf8 char. Clangd sets the message with a header specifying the wrong length which eats up the content-header for the following message.

I have to correct the situation by searching for the content-header.
I have now commented out that message box. The code works to correct the situation so we don't need that anymore.

Thanks for testing and finding these "gotchas" I've forgotten about.
Pages: [1] 2 3 4 5 6 ... 10