Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Code completion using LSP and clangd
ollydbg:
--- Quote from: ollydbg on July 15, 2022, 08:57:56 am ---
I will try to rebuild the C::B and clangd_client plugin with wx 3.1.7 later today to see whether it is the wx related issue.
--- End quote ---
The issue persist with wx 3.1.7. So, it looks like this is not a wx related issue.
Can someone share a C::B + clangd_client plugin, so that I can tested in my PC? Thanks.
ollydbg:
I have upload a screen cast mp4 file in zip file about this issue.
See here:
go declaration got error Issue 1 asmwarrior/clangd_client_bug_2022
Because this forum does not allow a file larger than 512K, I upload to github issue, clangd_go_decl_bug.zip
ollydbg:
Hi, Pecan, I did some test, I tred to use different clangd from winlibs, I tried to used to use the online visual studio code.
It looks like clangd does not have this issue. so I guess the issue is inside the clangd_plugin code. clangd_plugin rev66 about one months ago works OK.
I compared rev67 and rev66, especially the log file. By comparing the logs from clangd_plugin rev66 and rev67, I noticed some difference.
It looks like the textDocument/didOpen method is different. In rev67, it just send an empty string.
Here is the log of rev66, it looks good. (Note I cut down the source file path, because it was a bit long)
--- Code: ---20:25:11.290 <<< Content-Length: 614
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"cpp","text":"\r\n\r\n\r\n\r\nint abc;\r\n\r\n\r\nint main()\r\n{\r\n abc = 3;\r\n return 0;\r\n}\r\n\r\n\r\n#include <string>\r\n\r\n\r\nstd::string Utf8ToGbk(const std::string& strUtf8);\r\n\r\nstd::string Utf8ToGbk(const std::string& strUtf8)\r\n{\r\n // 上面的函数\r\n // return unicodeString.ToStdString(); 默认使用当前操作系统的编码格式,Windows通常为GB2312\r\n return strUtf8;\r\n}\r\n\r\n\r\n\r\n","uri":"file:///D:/project/test5-readtext/a.cpp","version":0}}}
--- End code ---
In rev67, the log looks wrong, because an empty string is passed.
--- Code: ---20:27:05.074 <<< Content-Length: 185
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"cpp","text":"","uri":"file:///D:/test5-readtext/a.cpp","version":0}}}
--- End code ---
You can see, the "text":"". So, it just send the empty string to the clangd?
ollydbg:
OK, it looks like the change in rev67 is here:
--- Code: ---@@ -1664,9 +1683,13 @@ bool ProcessLanguageClient::LSP_DidOpen(cbEditor* pcbEd)
// save current length of the file
m_FileLinesHistory[pcbEd] = pCntl->GetLineCount();
- wxString strText = pCntl->GetText();
- //-const char* pText = strText.mb_str(); //works //(ph 2022/01/17)
- const char* pText = strText.ToUTF8(); //ollydbg 220115 did not solve illegal utf8char
+ #if wxCHECK_VERSION(3,1,5) //3.1.5 or higher
+ wxString strText = pCntl->GetText().utf8_string(); //solves most illegal utf8chars
+ #else
+ //const char* pText = strText.mb_str(); //works //(ph 2022/01/17)
+ wxString strText = pCntl->GetText().ToUTF8(); //ollydbg 220115 did not solve illegal utf8chars
+ #endif
+ const char* pText = strText.c_str();
--- End code ---
This code change looks wrong (cause my issue) here.
ollydbg:
--- Quote from: ollydbg on July 16, 2022, 02:53:01 pm ---OK, it looks like the change in rev67 is here:
--- Code: ---@@ -1664,9 +1683,13 @@ bool ProcessLanguageClient::LSP_DidOpen(cbEditor* pcbEd)
// save current length of the file
m_FileLinesHistory[pcbEd] = pCntl->GetLineCount();
- wxString strText = pCntl->GetText();
- //-const char* pText = strText.mb_str(); //works //(ph 2022/01/17)
- const char* pText = strText.ToUTF8(); //ollydbg 220115 did not solve illegal utf8char
+ #if wxCHECK_VERSION(3,1,5) //3.1.5 or higher
+ wxString strText = pCntl->GetText().utf8_string(); //solves most illegal utf8chars
+ #else
+ //const char* pText = strText.mb_str(); //works //(ph 2022/01/17)
+ wxString strText = pCntl->GetText().ToUTF8(); //ollydbg 220115 did not solve illegal utf8chars
+ #endif
+ const char* pText = strText.c_str();
--- End code ---
This code change looks wrong (cause my issue) here.
--- End quote ---
I just revert this changes in rev67, and rebuild the clangd_client plugin, and my issue is gone! :)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version