feat: support concurrency

This commit is contained in:
csh
2025-07-03 18:52:04 +08:00
parent 07feb1c52c
commit 3cc1fccc81
57 changed files with 6743 additions and 6377 deletions
@@ -0,0 +1,46 @@
#include <spdlog/spdlog.h>
#include "./shutdown_provider.hpp"
#include "../../protocol/transform/facade.hpp"
namespace lsp::providers::shutdown
{
std::string ShutdownProvider::ProvideResponse(const protocol::RequestMessage& request)
{
spdlog::debug("ShutdownProvider: Providing response for method {}", request.method);
try
{
// 触发关闭事件
NotifyLifecycleEvent(ServerLifecycleEvent::kShuttingDown);
// 构建响应 - shutdown 返回 null
protocol::ResponseMessage response;
response.id = request.id;
std::string json;
auto ec = glz::write_json(response, json);
if (ec)
{
return BuildErrorResponseMessage(request, protocol::ErrorCode::kInternalError, "Failed to serialize response");
}
spdlog::info("Shutdown request processed successfully");
return json;
}
catch (const std::exception& e)
{
spdlog::error("Shutdown request failed: {}", e.what());
return BuildErrorResponseMessage(request, protocol::ErrorCode::kInternalError, e.what());
}
}
std::string ShutdownProvider::GetMethod() const
{
return "shutdown";
}
std::string ShutdownProvider::GetProviderName() const
{
return "ShutdownProvider";
}
}