@Christo
I've made some mods to clangd_client to more properly handle a custom makefile project.
Because a makefile project most likely does not contain all the info needed by clangd to properly parse a translation unit, it gets a large number of lines marked as errors.
I've adjusted clangd_client to pause parsing when the activated project is marked "custom makefile".
But the user can force parsing by unticking "Pause parsing (toggle)" for the project entry in the Projects tree.
Parsing can also be invoked by choosing "Reparse this project" in the Projects entry.
See the snapshot jpg below.
You might also consider adding ".cache" to the list of excluded files. Clangd keeps a lot of .idx files in that directory.
Just a thought to avoid confusing other plugins, you might consider the following (maybe overly cautious) changes:
The close will flush any status other plugins might be holding. And the new open will load a cleanly saved project that other plugins may have missed with just a "SetProject()" call.
To do this, I've commented some lines of your code. You may have to adjust as you see fit.
else
{
//projectManager->BeginLoadingProject();
prj->SetMakefileCustom(true);
prj->AddBuildTarget("all");
wxArrayInt targets;
targets.Add(0);
projectManager->AddMultipleFilesToProject(filelist, prj, targets);
Manager::Get()->GetLogManager()->Log(wxString::Format(_("%s Added %d files!"), pluginName, (int)filelist.GetCount()));
prj->SetModified(true);
prj->CalculateCommonTopLevelPath();
prj->Save();
//projectManager->EndLoadingProject(prj);
if (!projectManager->IsLoadingWorkspace())
{
//- projectManager->SetProject(prj);
/** Close a project.
* @param project A pointer to the project to close.
* @param dontsave Force not (!) saving the project on close.
* @param refresh Force a refresh of the project tree after closing a project.
* @return True if project was closed, false if not.
*/
bool ok = projectManager->CloseProject(prj, /*bool dontsave =*/ true, /*bool refresh =*/ true);
/** Load a project from disk. This function, internally, uses IsOpen()
* so that the same project can't be loaded twice.
* @param filename The project file's filename.
* @param activateIt Active the project after loading.
* @return If the function succeeds, a pointer to the newly opened project
* is returned. Else the return value is NULL.
*/
//cbProject* LoadProject(const wxString& filename, bool activateIt = true);
cbProject* prj = projectManager->LoadProject(fileName, true);
}
projectManager->GetUI().RebuildTree();
ret = true;
}
return ret;
Your plugin works well on Windows also with the following added target:
<Target title="to_wn_wx32_64">
<Option output="bin/MakefileProjectWithExistingCode" prefix_auto="1" extension_auto="1" />
<Option object_output=".objs/to_codeblocks_wx32" />
<Option type="3" />
<Option compiler="gcc" />
<Option parameters="--debug-log --multiple-instance --no-splash-screen --verbose -p debug --no-dde --no-check-associations /p debug" />
<Option host_application="$(CODEBLOCKS)/../devel32_64/codeblocks.exe" />
<Option run_host_application_in_terminal="0" />
<Compiler>
<Add option="-g" />
<Add directory="$(#wx32.include)" />
<Add directory="$(#wx32.lib)/gcc_dll/mswu" />
<Add directory="$(#cb)/include" />
<Add directory="$(#cb)/sdk/wxscintilla/include" />
<Add directory="$(#cb)/include/tinyxml" />
</Compiler>
<Linker>
<Add library="wxmsw32u" />
<Add library="codeblocks" />
<Add directory="$(#wx32.lib)/gcc_dll" />
<Add directory="$(#cb)/devel32_64" />
<Add directory="$(#cb)/devel32" />
</Linker>
<ExtraCommands>
<Add before="cmd.exe /c echo CodeBlocks: $(codeblocks)" />
<Add before="cmd.exe /c echo cb: $(#cb)" />
<Add before="cmd.exe /c echo LinkFrom: $(#cb)\devel32_64" />
<Add after="zip -j9 .\bin\MakefileProjectWithExistingCode.zip manifest.xml" />
<Add after="cmd /c copy bin\MakefileProjectWithExistingCode.zip $(CODEBLOCKS)\..\devel32_64\share\codeblocks\" />
<Add after="cmd /c copy bin\MakefileProjectWithExistingCode.dll $(CODEBLOCKS)\..\devel32_64\share\codeblocks\plugins\" />
<Mode after="always" />
</ExtraCommands>
</Target>
Thanks for your work.