tree-sitter and lsp-methods

This commit is contained in:
csh
2025-09-14 12:28:37 +08:00
parent e9972fd869
commit aac12137cb
214 changed files with 350938 additions and 142202 deletions
@@ -0,0 +1,40 @@
#include <spdlog/spdlog.h>
#include "./set_trace.hpp"
#include "../../protocol/transform/facade.hpp"
namespace lsp::providers
{
std::string SetTrace::GetMethod() const
{
return "$/setTrace";
}
std::string SetTrace::GetProviderName() const
{
return "SetTrace";
}
void SetTrace::HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context)
{
static_cast<void>(context);
spdlog::debug("SetTraceProvider: Providing response for method {}", notification.method);
protocol::SetTraceParams params = transform::As<protocol::SetTraceParams>(notification.params.value());
if (params.value == protocol::TraceValueLiterals::Off)
{
spdlog::set_level(spdlog::level::info);
spdlog::info("SetTrace: Tacing disabled");
}
else if (params.value == protocol::TraceValueLiterals::Messages)
{
spdlog::set_level(spdlog::level::debug);
spdlog::info("SetTrace: Tacing enabled (message only)");
}
else if (params.value == protocol::TraceValueLiterals::Verbose)
{
spdlog::set_level(spdlog::level::trace);
spdlog::info("SetTrace: Tacing enabled (verbose)");
}
}
}
@@ -1,14 +1,13 @@
#pragma once
#include "../base/provider_interface.hpp"
namespace lsp::providers::set_trace
{
class SetTraceProvider : public INotificationProvider
{
public:
SetTraceProvider() = default;
std::string GetMethod() const override;
std::string GetProviderName() const override;
void HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context) override;
};
}
#pragma once
#include "../base/provider_interface.hpp"
namespace lsp::providers
{
class SetTrace : public INotificationProvider
{
public:
std::string GetMethod() const override;
std::string GetProviderName() const override;
void HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context) override;
};
}
@@ -1,22 +0,0 @@
#include <spdlog/spdlog.h>
#include "./set_trace_provider.hpp"
namespace lsp::providers::set_trace
{
std::string SetTraceProvider::GetMethod() const
{
return "$/setTrace";
}
std::string SetTraceProvider::GetProviderName() const
{
return "SetTraceProvider";
}
void SetTraceProvider::HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context)
{
static_cast<void>(context);
spdlog::debug("SetTraceProvider: Providing response for method {}", notification.method);
}
}