This commit is contained in:
csh
2025-07-05 10:38:05 +08:00
parent 3cc1fccc81
commit 0c4619261d
39 changed files with 2085 additions and 875 deletions
@@ -0,0 +1,34 @@
#include "./cancel_request_provider.hpp"
namespace lsp::providers::cancel_request
{
std::string CancelRequestProvider::GetMethod() const
{
return "$/cancelRequest";
}
std::string CancelRequestProvider::GetProviderName() const
{
return "CancelRequestProvider";
}
void CancelRequestProvider::HandleNotification(const protocol::NotificationMessage& notification, ProviderContext& context)
{
try
{
auto params = transform::As<protocol::CancelParams>(notification.params.value());
std::string id_to_cancel = transform::debug::GetIdString(params.id);
spdlog::info("Processing cancel request for ID: {}", id_to_cancel);
if (auto* scheduler = context.GetScheduler())
{
bool cancelled = scheduler->Cancel(id_to_cancel);
spdlog::info("Cancel request {} result: {}", id_to_cancel, cancelled ? "success" : "not found");
}
}
catch (const std::exception& e)
{
spdlog::error("Error handling cancel request: {}", e.what());
}
}
}
@@ -0,0 +1,16 @@
#pragma once
#include <spdlog/spdlog.h>
#include "../base/provider_interface.hpp"
#include "../../scheduler/request_scheduler.hpp"
#include "../../protocol/transform/facade.hpp"
namespace lsp::providers::cancel_request
{
class CancelRequestProvider : public INotificationProvider
{
public:
std::string GetMethod() const override;
std::string GetProviderName() const override;
void HandleNotification(const protocol::NotificationMessage& notification, ProviderContext& context) override;
};
}