58 lines
1.8 KiB
C++
58 lines
1.8 KiB
C++
module;
|
|
|
|
#include <format>
|
|
|
|
export module lsp.manager.bootstrap;
|
|
import spdlog;
|
|
|
|
import std;
|
|
import lsp.manager.manager_hub;
|
|
import lsp.scheduler.async_executor;
|
|
import lsp.utils.args_parser;
|
|
|
|
export namespace lsp::manager::bootstrap
|
|
{
|
|
void InitializeManagerHub(
|
|
ManagerHub& hub,
|
|
scheduler::AsyncExecutor& async_executor,
|
|
const std::vector<std::string>& system_lib_paths);
|
|
}
|
|
|
|
namespace lsp::manager::bootstrap
|
|
{
|
|
void InitializeManagerHub(
|
|
ManagerHub& hub,
|
|
scheduler::AsyncExecutor& async_executor,
|
|
const std::vector<std::string>& system_lib_paths)
|
|
{
|
|
spdlog::info("Initializing manager hub...");
|
|
|
|
for (const auto& path : system_lib_paths)
|
|
{
|
|
std::string task_name = std::format("Load system library: {}", path);
|
|
|
|
async_executor.Submit(
|
|
task_name,
|
|
[&hub, path]() -> std::optional<std::string> {
|
|
try
|
|
{
|
|
hub.symbols().LoadSystemLibrary(path);
|
|
return std::format("Loaded system library: {}", path);
|
|
}
|
|
catch (const std::exception& e)
|
|
{
|
|
spdlog::error("Failed to load system library {}: {}", path, e.what());
|
|
throw;
|
|
}
|
|
},
|
|
[path](const std::optional<std::string>& result, bool cancelled) {
|
|
if (cancelled)
|
|
spdlog::info("System library load task cancelled: {}", path);
|
|
else if (result)
|
|
spdlog::info("{}", *result);
|
|
});
|
|
}
|
|
spdlog::info("Manager hub initialized, system library loading in background");
|
|
}
|
|
}
|