♻️ 使用module重构所有代码

This commit is contained in:
csh
2025-12-07 23:07:03 +08:00
parent 549f1d1b0a
commit f7d5a74615
369 changed files with 2272844 additions and 2202476 deletions
@@ -0,0 +1,59 @@
module;
export module lsp.provider.shutdown.shutdown;
import spdlog;
import std;
import lsp.protocol;
import lsp.codec.facade;
import lsp.provider.base.interface;
namespace transform = lsp::codec;
export namespace lsp::provider
{
class Shutdown : public IRequestProvider
{
public:
Shutdown() = default;
std::string GetMethod() const override;
std::string GetProviderName() const override;
std::string ProvideResponse(const protocol::RequestMessage& request, ExecutionContext& context) override;
};
}
namespace lsp::provider
{
std::string Shutdown::GetMethod() const
{
return "shutdown";
}
std::string Shutdown::GetProviderName() const
{
return "Shutdown";
}
std::string Shutdown::ProvideResponse(const protocol::RequestMessage& request, ExecutionContext& context)
{
spdlog::debug("ShutdownProvider: Providing response for method {}", request.method);
// 触发关闭事件
context.TriggerLifecycleEvent(ServerLifecycleEvent::kShuttingDown);
context.GetManagerHub().Shutdown();
// 构建响应 - shutdown 返回 null
protocol::ResponseMessage response;
response.id = request.id;
auto json = transform::Serialize(response);
if (!json.has_value())
return BuildErrorResponseMessage(request, protocol::ErrorCodes::InternalError, "Failed to serialize response");
spdlog::info("Shutdown request processed successfully");
return json.value();
}
}