module; export module lsp.provider.cancel_request.cancel_request; import spdlog; import std; import lsp.protocol.types; import lsp.codec.facade; import lsp.provider.base.interface; namespace transform = lsp::codec; export namespace lsp::provider { class CancelRequest : public AutoRegisterProvider { public: static constexpr std::string_view kMethod = "$/cancelRequest"; static constexpr std::string_view kProviderName = "CancelRequest"; CancelRequest() = default; void HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context) override; }; } namespace lsp::provider { void CancelRequest::HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context) { spdlog::debug("CancelRequestProvider received {}", notification.method); auto params = transform::FromLSPAny.template operator()(notification.params.value()); std::string id_to_cancel = transform::debug::GetIdString(params.id); spdlog::debug("Processing cancel request for ID: {}", id_to_cancel); auto& scheduler = context.GetScheduler(); bool cancelled = scheduler.Cancel(id_to_cancel); spdlog::debug("Cancel request {} {}", id_to_cancel, cancelled ? "succeeded" : "not found"); } }