Recent Posts

Pages: 1 2 3 4 [5] 6 7 8 9 10
41
Plugins development / Re: Code completion using LSP and clangd
« Last post by Pecan on March 22, 2024, 06:25:57 pm »
Applied modified christo patch to Clangd_client at Head rev 13493.
The patch supports additional fixes from Clangd version 18.
Thanks christo.
42
As I mentioned before, I am only willing to communicate the issues with someone in particular who is interested in taking notice.
I can message them (on Discord) the moment I encounter an issue and then I could provide whatever information is necessary in advance.
I could try to isolate the problem and provide a minimum reproducible code.

Yes, my version is likely not the most recent version built.
But the version 20.03 on Windows.
I am prone to think that the Linux build has far fewer issues (but there I would much rather use an alternative).
43
Using Code::Blocks / Re: Find functions called by or calling
« Last post by Evan on March 22, 2024, 10:06:03 am »
More simple solution for me in the meantime, is to use 'Find occurrences of' e.g. function name or variable and Code::Blocks finds all occurrences in the project and shows them in Logs & Others in ascending order.

That is to say the least, gold for me.  :)
44
General (but related to Code::Blocks) / Re: Welcome Newcomers - PLEASE READ!!!
« Last post by tonyaimer1 on March 22, 2024, 07:50:16 am »
I am here from Johannesburg.

I want to get into numerical methods and C GUI programming - huge task I know.

The ecosysyem is massive.

I take heart from Eskil Steenberg who had a you tube video called "How I program in C"
who suggested we should embrace complexity and not be afraid of it - the beginning
that's where I am.

Tony
45
Please create a ticket and post the information there.

@RadicalInquisition:
Please mention the OS version, the CB version and revision,
attach any .RPT in the CodeBlocks executable folder.
And, if possible, some code to recreate the problem.

This looks suspiciously like a problem that has already been fixed in an (almost) recent commit.
46
Please create a ticket and post the information there.
47
Using Code::Blocks / Re: C::B Workspace/project to cmake or premake?
« Last post by Miguel Gimenez on March 21, 2024, 02:12:42 pm »
Spam reported to moderator.
48
Using Code::Blocks / Re: C::B Workspace/project to cmake or premake?
« Last post by lopuna3 on March 21, 2024, 12:56:22 pm »

They do exist, I have one installed under Kubuntu 22.04
https://github.com/chris-be/premake-codeblocks battleship game

These days I just use Code::Blocks.
And can this thing turn this cmakelist.txt into a Code::Blocks? Does it only work on Linux and only with this clang?

If you have a CMakeLists.txt file, you can generate Code::Blocks project files using CMake. However, the specific toolchain and compiler settings may vary depending on your platform.
49
Plugins development / Re: Code completion using LSP and clangd
« Last post by Pecan on March 20, 2024, 08:33:50 pm »
Hi Pecan,

I found two issues with applying fix in my setup. I'm using clangd version 18.0.0
1. "fixes available" along with "fix available"
2. Multi line fixes, eg: unused header warnings.

Below modification helped to apply these fixes.
Code
diff --git a/src/plugins/contrib/clangd_client/src/LSPclient/lspdiagresultslog.cpp b/src/plugins/contrib/clangd_client/src/LSPclient/lspdiagresultslog.cpp
index b64e7d760..425268724 100644
--- a/src/plugins/contrib/clangd_client/src/LSPclient/lspdiagresultslog.cpp
+++ b/src/plugins/contrib/clangd_client/src/LSPclient/lspdiagresultslog.cpp
@@ -256,7 +256,7 @@ void LSPDiagnosticsResultsLog::OnApplyFixIfAvailable(wxCommandEvent& event) //(p
     {
         // Got the selected item index
         selectedLineText = GetItemAsText(itemIndex);
-        if (not selectedLineText.Contains(" (fix available) "))
+        if (not (selectedLineText.Contains(" (fix available) ") or (selectedLineText.Contains("(fixes available)"))))
         {
             wxString msg = wxString::Format(_("No Fix available for logLine(%d)"), int(itemIndex) );
             InfoWindow::Display(_("NO fix"), msg);
diff --git a/src/plugins/contrib/clangd_client/src/codecompletion/parser/parser.cpp b/src/plugins/contrib/clangd_client/src/codecompletion/parser/parser.cpp
index b97e46a30..2ef369352 100644
--- a/src/plugins/contrib/clangd_client/src/codecompletion/parser/parser.cpp
+++ b/src/plugins/contrib/clangd_client/src/codecompletion/parser/parser.cpp
@@ -3688,15 +3688,17 @@ void Parser::OnRequestCodeActionApply(wxCommandEvent& event) //(ph 2024/02/12)
         int startLine; // 1 origin; needs to be changed to zero origin
         int lineStartCol;
         int lineEndCol;
+        int endLine;
 
         codeActionStr  = FixesFound[ii];
         try {
             // std::string testData = "{\"newText\":\"int\",\"range\":{\"end\":{\"character\":8,\"line\":275},\"start\":{\"character\":4,\"line\":275}}}"; // **Debugging**
             nlohmann::json jCodeAction = nlohmann::json::parse(codeActionStr.ToStdString());
             newText      = jCodeAction["newText"].get<std::string>();
-            startLine    = lineNumInt; // it's already 1 origin
+            startLine    = jCodeAction["range"]["start"]["line"] ;
             lineStartCol = jCodeAction["range"]["start"]["character"] ;
             lineEndCol   = jCodeAction["range"]["end"]["character"] ;
+            endLine      = jCodeAction["range"]["end"]["line"] ;
         }
         catch(std::exception &err)
         {
@@ -3708,9 +3710,12 @@ void Parser::OnRequestCodeActionApply(wxCommandEvent& event) //(ph 2024/02/12)
         // pEd contains the cbEditor ptr from above
         cbStyledTextCtrl* pControl = pEd->GetControl();
          // Replace text; note that the startLine is from the log msg line, so it's 1 origin
-        int linePosn = pControl->PositionFromLine(startLine-1); // use zero origin for line
-        pControl->SetTargetStart(linePosn + lineStartCol);
-        pControl->SetTargetEnd(linePosn + lineEndCol );
+        int linePosn = pControl->PositionFromLine(startLine); // use zero origin for line
+        int targetStart = linePosn + lineStartCol;
+        pControl->SetTargetStart(targetStart);
+        int lineEndPosn = pControl->PositionFromLine(endLine);
+        int targetEnd = lineEndPosn + lineEndCol;
+        pControl->SetTargetEnd(targetEnd);
         pControl->ReplaceTarget(newText);
     }//endfor FixesFound
 

Thanks, Christo

@ christo
Thanks for your work on this.
When there are multiple extraneous #includes in the same file, the patch is taking out the wrong lines after the first one is successful.

So I'll hold onto this until I have time to find out why.

50
There goes the next new Code Blocks-related issue.  :)
A sudden crash when I type in the parenthesis of a function-like macro in a pre-processor conditional.

I also recorded a video (It is unlisted):
https://www.youtube.com/watch?v=ItL7eMKh7F4&ab_channel=CodeBlocksFails

I haven't looked into it, but it might be the parser-provided syntax complete (which is also quite bad per se).
Pages: 1 2 3 4 [5] 6 7 8 9 10