This commit is contained in:
csh
2025-07-02 14:29:54 +08:00
parent 65b38b7fec
commit dbc95ff098
61 changed files with 6673 additions and 617 deletions
@@ -1,35 +1,24 @@
#include <spdlog/spdlog.h>
#include "./set_trace_provider.hpp"
namespace lsp::providers::trace
{
nlohmann::json SetTraceProvider::ProvideResponse(const LspRequest& request)
std::string SetTraceProvider::ProvideResponse(const protocol::RequestMessage& request)
{
try
{
auto params = request.params;
if (params.contains("value"))
{
std::string trace_value = params["value"];
// 这里可以设置跟踪级别
// 例如:设置全局跟踪变量
}
}
catch (const std::exception& e)
{
// 处理错误
}
// 通知不需要响应
return nlohmann::json();
spdlog::debug("SetTraceProvider: Providing response for method {}", request.method);
std::string json;
glz::obj empty_obj{}; // glaze的对象类型
auto ec = glz::write_json(empty_obj, json);
return ec ? BuildErrorMessageResponse(protocol::ErrorCode::kInternalError, "Internal error") : json;
}
inline std::string SetTraceProvider::GetMethod() const
std::string SetTraceProvider::GetMethod() const
{
return "$/setTrace";
}
inline std::string SetTraceProvider::GetProviderName() const
std::string SetTraceProvider::GetProviderName() const
{
return "SetTraceProvider";
}