tsl-devkit/lsp-server/src/provider/exit/exit.cpp

32 lines
798 B
C++

#include "./exit.hpp"
namespace lsp::provider
{
std::string Exit::GetMethod() const
{
return "exit";
}
std::string Exit::GetProviderName() const
{
return "Exit";
}
void Exit::HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context)
{
spdlog::debug("ExitProvider: Providing response for method {}", notification.method);
spdlog::info("Exit notification received");
// 触发生命周期事件
context.TriggerLifecycleEvent(ServerLifecycleEvent::kShuttingDown);
// 给一些时间完成清理
std::this_thread::sleep_for(std::chrono::milliseconds(100));
context.TriggerLifecycleEvent(ServerLifecycleEvent::kShutdown);
std::exit(0);
}
}