Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Code completion using LSP and clangd
ollydbg:
I see an annoying issue that the focus changes of the log message.
Here is the steps to reproduce:
1, I hit the "save" (or the "save all") toolbar botton
2, I hit the "build" toolbar botton
3, The building process starts, and the active log is switched to the build log
4, after for a while, the active log is switched to the LSP message.
In the step 4, it is a bit annoying. Can we stop the focus switch in the step 4?
Or we can only switch the LSP message if the compiler(build process) is not running.
Thanks.
EDIT:
I see such code snippet about the log switch(focus)
--- Code: --- // If last request was anything but "textDocument/didSave", don't steal the log focus.
if ( not popupActive ) switch(1)
{
default:
// switch to LSP messages only when user used "save"
if (not GetLSPClient()->GetSaveFileEventOccured()) break;
wxWindow* pFocusedWin = wxWindow::FindFocus();
if (not GetLSPClient()->LSP_GetLog()) break;
CodeBlocksLogEvent evtSwitch(cbEVT_SWITCH_TO_LOG_WINDOW, GetLSPClient()->LSP_GetLog());
CodeBlocksLogEvent evtShow(cbEVT_SHOW_LOG_MANAGER);
Manager::Get()->ProcessEvent(evtSwitch);
Manager::Get()->ProcessEvent(evtShow);
if (pFocusedWin) pFocusedWin->SetFocus();
}
--- End code ---
I'm not sure why you combine the if and switch statement in the same line?
ollydbg:
I see some bugs here:
BUG1:
1, I have 5 cbp files in the same folder, and I also have a workspace file which contains the 5 cbp files.
2, I open the workskpace, and switch the active project between those 5 cbps
3, When I close the C::B or close the workspace, I got 4 error messages:
--- Code: ---19:17:44: File 'D:\code\plugin\wxModularApp\build\.cache\Clangd-cache.lock' couldn't be removed (error 2: 系统找不到指定的文件。)
19:17:45: File 'D:\code\plugin\wxModularApp\build\.cache\Clangd-cache.lock' couldn't be removed (error 2: 系统找不到指定的文件。)
19:17:45: File 'D:\code\plugin\wxModularApp\build\.cache\Clangd-cache.lock' couldn't be removed (error 2: 系统找不到指定的文件。)
19:17:45: File 'D:\code\plugin\wxModularApp\build\.cache\Clangd-cache.lock' couldn't be removed (error 2: 系统找不到指定的文件。)
--- End code ---
The Chinese words means "System cannot find the file specified.".
So, I think that this plugin use the same .lock file name for all the cbp projects?
BUG2:
1, I have 5 cbp files in the same folder, and I also have a workspace file which contains the 5 cbp files.
2, I open the workskpace, and switch the active project between those 5 cbps.
3, Now, I use the git tool to update those 5 cbp files, and C::B asked that whether I need to reload the cbp files, I press "all".
Now, I see that my CPU usage is from the 25% CPU (which is the 1 thread in my clang_client setting) to 100%, and I see 4 clangd.exe running in the task manager window.
Each process of clangd eat about 25% of the cpu.
I guess that when 5 cbp files get reloaded in the same time, it will trigger several clangd.exe to run.
My testing project is:
asmwarrior/wxModularApp: Cross-Platform Modular Application (Main app + plugins) example for C++/wxWidgets
ollydbg:
There is another issue to show the LSP messages.
Suppose you have several cpp files in the cbp, when you first open the cbp, you get all the LSP diagnostics from all the cpp files.
But once you edit only one cpp file, and press "save" button, the whole "LSP message" will be cleaned, and only the recent saved cpp file's diagnostics will be shown.
So, I suggest if we can only update the updated files' message, but keep the old ones, thanks.
ollydbg:
Hi, guys, I think I found an issue when using clangd under msys2.
In the instruction:
CB Clangd Client / Code / [r41] /trunk/clangd_client/documentation-install/Windows-LLVM-ClangD-Install-Readme.txt
It said:
--- Code: ---MSYS2 Compiler - MinGW64
-------------------------
There are two main options to install the clangd.exe as follows:
1) The first option in order to minimise disk space is to install the Clang extra tools using one of the following packages:
+------------------------------------------+------------------------+
| Package | Clangd executable |
+------------------------------------------+------------------------+
| mingw-w64-clang-x86_64-clang-tools-extra | clang64/bin/clangd.exe |
| mingw-w64-x86_64-clang-tools-extra | mingw64/bin/clangd.exe |
+------------------------------------------+------------------------+
To intall the package do the following:
a) Open the msys2.exe bash shell
b) Run the following command:
pacman -S <Package name in the table above>
OR
2) The second option is to intall the full Clang tool chain as follows:
a) Open the msys2.exe bash shell
b) Run the following command:
pacman -S mingw-w64-clang-x86_64-toolchain
--- End code ---
If you are using the gcc from msys2, I mean the compilers in the folder "msys64\mingw64\bin", you should use "mingw-w64-x86_64-clang-tools-extra", which means the clangd.exe is under the folder "msys64\mingw64\bin" (the same folder in your gcc.exe).
If you are using the clang tool chain, I mean you use the compiler from the folder "msys64\clang64\bin", you should use "mingw-w64-clang-x86_64-clang-tools-extra".
I found that I just make a big mistake in one of my PC, that is I use the gcc toolchain from "msys64\mingw64\bin", but I use the clangd.exe from "msys64\clang64\bin", the result is I got a lot of LSP diagnostics messages about the errors. ;) Luckily I found the reason, and fix this issue. Hope this will help other guys. :)
AndrewCot:
Can you raise a ticket for this so I do not forget about it as it may not be as simple as changing the docs as the code may need some changes to ensure that end users with GCC and CLANG do not have issues like you found.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version