tree-sitter and lsp-methods
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#include "./cancel_request.hpp"
|
||||
|
||||
namespace lsp::providers
|
||||
{
|
||||
std::string CancelRequest::GetMethod() const
|
||||
{
|
||||
return "$/cancelRequest";
|
||||
}
|
||||
|
||||
std::string CancelRequest::GetProviderName() const
|
||||
{
|
||||
return "CancelRequest";
|
||||
}
|
||||
|
||||
void CancelRequest::HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context)
|
||||
{
|
||||
spdlog::debug("CancelRequestProvider: Providing response for method {}", notification.method);
|
||||
|
||||
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);
|
||||
|
||||
auto& scheduler = context.GetScheduler();
|
||||
bool cancelled = scheduler.Cancel(id_to_cancel);
|
||||
spdlog::info("Cancel request {} result: {}", id_to_cancel, cancelled ? "success" : "not found");
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,14 +1,14 @@
|
||||
#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
|
||||
namespace lsp::providers
|
||||
{
|
||||
class CancelRequestProvider : public INotificationProvider
|
||||
class CancelRequest : public INotificationProvider
|
||||
{
|
||||
public:
|
||||
CancelRequest() = default;
|
||||
std::string GetMethod() const override;
|
||||
std::string GetProviderName() const override;
|
||||
void HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context) override;
|
||||
@@ -1,33 +0,0 @@
|
||||
#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, ExecutionContext& 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);
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user