♻️ 使用module重构所有代码
This commit is contained in:
+27
-4
@@ -1,6 +1,29 @@
|
||||
#include <spdlog/spdlog.h>
|
||||
#include "./register_capability.hpp"
|
||||
#include "../../protocol/transform/facade.hpp"
|
||||
module;
|
||||
|
||||
|
||||
export module lsp.provider.client.register_capability;
|
||||
import spdlog;
|
||||
|
||||
import std;
|
||||
|
||||
import lsp.protocol;
|
||||
import lsp.codec.facade;
|
||||
import lsp.provider.base.interface;
|
||||
|
||||
namespace transform = lsp::codec;
|
||||
|
||||
export namespace lsp::provider::client
|
||||
{
|
||||
class RegisterCapability : public IRequestProvider
|
||||
{
|
||||
public:
|
||||
RegisterCapability() = default;
|
||||
|
||||
std::string GetMethod() const override;
|
||||
std::string GetProviderName() const override;
|
||||
std::string ProvideResponse(const protocol::RequestMessage& request, ExecutionContext& context) override;
|
||||
};
|
||||
}
|
||||
|
||||
namespace lsp::provider::client
|
||||
{
|
||||
@@ -16,7 +39,7 @@ namespace lsp::provider::client
|
||||
|
||||
std::string RegisterCapability::ProvideResponse(const protocol::RequestMessage& request, [[maybe_unused]] ExecutionContext& context)
|
||||
{
|
||||
spdlog::debug("RegisterCapabilityProvider: Providing response for method {}", request.method);
|
||||
spdlog::debug("RegisterCapabilityProvider: Providing response for method {}", request.method);
|
||||
// 这个方法通常不会被调用,因为这是服务器发起的请求
|
||||
// 但为了完整性还是实现它
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "../base/interface.hpp"
|
||||
#include "../../protocol/protocol.hpp"
|
||||
|
||||
namespace lsp::provider::client
|
||||
{
|
||||
class RegisterCapability : public IRequestProvider
|
||||
{
|
||||
public:
|
||||
RegisterCapability() = default;
|
||||
|
||||
std::string GetMethod() const override;
|
||||
std::string GetProviderName() const override;
|
||||
std::string ProvideResponse(const protocol::RequestMessage& request, ExecutionContext& context) override;
|
||||
};
|
||||
}
|
||||
+27
-4
@@ -1,6 +1,29 @@
|
||||
#include <spdlog/spdlog.h>
|
||||
#include "./unregister_capability.hpp"
|
||||
#include "../../protocol/transform/facade.hpp"
|
||||
module;
|
||||
|
||||
|
||||
export module lsp.provider.client.unregister_capability;
|
||||
import spdlog;
|
||||
|
||||
import std;
|
||||
|
||||
import lsp.protocol;
|
||||
import lsp.codec.facade;
|
||||
import lsp.provider.base.interface;
|
||||
|
||||
namespace transform = lsp::codec;
|
||||
|
||||
export namespace lsp::provider::client
|
||||
{
|
||||
class UnregisterCapability : public IRequestProvider
|
||||
{
|
||||
public:
|
||||
UnregisterCapability() = default;
|
||||
|
||||
std::string GetMethod() const override;
|
||||
std::string GetProviderName() const override;
|
||||
std::string ProvideResponse(const protocol::RequestMessage& request, ExecutionContext& context) override;
|
||||
};
|
||||
}
|
||||
|
||||
namespace lsp::provider::client
|
||||
{
|
||||
@@ -16,7 +39,7 @@ namespace lsp::provider::client
|
||||
|
||||
std::string UnregisterCapability::ProvideResponse(const protocol::RequestMessage& request, [[maybe_unused]] ExecutionContext& context)
|
||||
{
|
||||
spdlog::debug("UnregisterCapabilityProvider: Providing response for method {}", request.method);
|
||||
spdlog::debug("UnregisterCapabilityProvider: Providing response for method {}", request.method);
|
||||
protocol::ResponseMessage response;
|
||||
response.id = request.id;
|
||||
response.result = std::nullopt;
|
||||
@@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "../base/interface.hpp"
|
||||
#include "../../protocol/protocol.hpp"
|
||||
|
||||
namespace lsp::provider::client
|
||||
{
|
||||
class UnregisterCapability : public IRequestProvider
|
||||
{
|
||||
public:
|
||||
UnregisterCapability() = default;
|
||||
|
||||
std::string GetMethod() const override;
|
||||
std::string GetProviderName() const override;
|
||||
std::string ProvideResponse(const protocol::RequestMessage& request, ExecutionContext& context) override;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user