module; export module lsp.provider.trace.set_trace; import spdlog; import std; import lsp.protocol; import lsp.codec.facade; import lsp.provider.base.interface; namespace transform = lsp::codec; export namespace lsp::provider { class SetTrace : public INotificationProvider { public: std::string GetMethod() const override; std::string GetProviderName() const override; void HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context) override; }; } namespace lsp::provider { std::string SetTrace::GetMethod() const { return "$/setTrace"; } std::string SetTrace::GetProviderName() const { return "SetTrace"; } void SetTrace::HandleNotification(const protocol::NotificationMessage& notification, [[maybe_unused]] ExecutionContext& context) { spdlog::debug("SetTrace notification {}", notification.method); protocol::SetTraceParams params = transform::FromLSPAny.template operator()(notification.params.value()); if (params.value == protocol::TraceValueLiterals::Off) { spdlog::set_level(spdlog::level::info); spdlog::debug("Trace level set to off"); } else if (params.value == protocol::TraceValueLiterals::Messages) { spdlog::set_level(spdlog::level::debug); spdlog::debug("Trace level set to debug (messages)"); } else if (params.value == protocol::TraceValueLiterals::Verbose) { spdlog::set_level(spdlog::level::trace); spdlog::debug("Trace level set to trace (verbose)"); } } }