feat(provider): add compile-time registry

This commit is contained in:
csh
2025-12-21 22:21:46 +08:00
parent f54050bad2
commit 2c1c1d8a88
82 changed files with 751 additions and 1001 deletions
+6 -12
View File
@@ -14,28 +14,22 @@ namespace transform = lsp::codec;
export namespace lsp::provider
{
class Shutdown : public IRequestProvider
class Shutdown : public AutoRegisterProvider<Shutdown, IRequestProvider>
{
public:
static constexpr std::string_view kMethod = "shutdown";
static constexpr std::string_view kProviderName = "Shutdown";
Shutdown() = default;
std::string GetMethod() const override;
std::string GetProviderName() const override;
std::string ProvideResponse(const protocol::RequestMessage& request, ExecutionContext& context) override;
};
}
namespace lsp::provider
{
std::string Shutdown::GetMethod() const
{
return "shutdown";
}
std::string Shutdown::GetProviderName() const
{
return "Shutdown";
}
std::string Shutdown::ProvideResponse(const protocol::RequestMessage& request, ExecutionContext& context)
{
@@ -56,4 +50,4 @@ namespace lsp::provider
return json.value();
}
}
}