rename : DocumentManager
This commit is contained in:
parent
7255cd68f5
commit
aad4917fc0
|
|
@ -19,10 +19,10 @@ namespace lsp::core
|
|||
spdlog::debug("RequestScheduler set in dispatcher");
|
||||
}
|
||||
|
||||
void RequestDispatcher::SetDocumentManager(services::DocumentManager* document_manager)
|
||||
void RequestDispatcher::SetDocumentService(services::DocumentService* document_manager)
|
||||
{
|
||||
document_manager_ = document_manager;
|
||||
spdlog::debug("DocumentManager is set in dispatcher");
|
||||
document_service_ = document_manager;
|
||||
spdlog::debug("DocumentService is set in dispatcher");
|
||||
}
|
||||
|
||||
void RequestDispatcher::RegisterRequestProvider(std::shared_ptr<providers::IRequestProvider> provider)
|
||||
|
|
@ -52,7 +52,7 @@ namespace lsp::core
|
|||
|
||||
std::string RequestDispatcher::Dispatch(const protocol::RequestMessage& request)
|
||||
{
|
||||
providers::ExecutionContext context(scheduler_, context_lifecycle_callback_, document_manager_);
|
||||
providers::ExecutionContext context(scheduler_, context_lifecycle_callback_, document_service_);
|
||||
|
||||
std::shared_lock<std::shared_mutex> lock(providers_mutex_);
|
||||
auto it = providers_.find(request.method);
|
||||
|
|
@ -76,7 +76,7 @@ namespace lsp::core
|
|||
|
||||
void RequestDispatcher::Dispatch(const protocol::NotificationMessage& notification)
|
||||
{
|
||||
providers::ExecutionContext context(scheduler_, context_lifecycle_callback_, document_manager_);
|
||||
providers::ExecutionContext context(scheduler_, context_lifecycle_callback_, document_service_);
|
||||
|
||||
std::shared_lock<std::shared_mutex> lock(notification_providers_mutex_);
|
||||
// 先尝试精确匹配
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace lsp::core
|
|||
~RequestDispatcher() = default;
|
||||
|
||||
void SetRequestScheduler(scheduler::RequestScheduler* scheduler);
|
||||
void SetDocumentManager(services::DocumentManager* document_manager);
|
||||
void SetDocumentService(services::DocumentService* document_manager);
|
||||
|
||||
void RegisterRequestProvider(std::shared_ptr<providers::IRequestProvider> provider);
|
||||
void RegisterNotificationProvider(std::shared_ptr<providers::INotificationProvider> provider);
|
||||
|
|
@ -52,7 +52,6 @@ namespace lsp::core
|
|||
|
||||
// 服务引用
|
||||
scheduler::RequestScheduler* scheduler_ = nullptr;
|
||||
services::DocumentManager* document_manager_ = nullptr;
|
||||
services::DocumentService* document_service_ = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ namespace lsp::core
|
|||
|
||||
void LspServer::InitializeCoreServices()
|
||||
{
|
||||
spdlog::debug("Initializing core services...");
|
||||
spdlog::debug("Initializing core services...");
|
||||
|
||||
dispatcher_.SetRequestScheduler(&scheduler_);
|
||||
|
||||
|
|
@ -300,8 +300,8 @@ namespace lsp::core
|
|||
{
|
||||
spdlog::debug("Initializing extension services...");
|
||||
|
||||
document_manager_ = std::make_unique<services::DocumentManager>();
|
||||
dispatcher_.SetDocumentManager(document_manager_.get());
|
||||
document_service_ = std::make_unique<services::DocumentService>();
|
||||
dispatcher_.SetDocumentService(document_service_.get());
|
||||
|
||||
spdlog::debug("Extension services initialized");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace lsp::core
|
|||
scheduler::RequestScheduler scheduler_;
|
||||
|
||||
// 可选/扩展组件 -- 所以用智能指针
|
||||
std::unique_ptr<services::DocumentManager> document_manager_;
|
||||
std::unique_ptr<services::DocumentService> document_service_;
|
||||
|
||||
std::atomic<bool> is_initialized_ = false;
|
||||
std::atomic<bool> is_shutting_down_ = false;
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ namespace lsp::providers
|
|||
class ExecutionContext
|
||||
{
|
||||
public:
|
||||
ExecutionContext(scheduler::RequestScheduler* scheduler, LifecycleCallback lifecycle_callback, services::DocumentManager* document_manager = nullptr) :
|
||||
scheduler_(scheduler), lifecycle_callback_(lifecycle_callback), document_manager_(document_manager) {}
|
||||
ExecutionContext(scheduler::RequestScheduler* scheduler, LifecycleCallback lifecycle_callback, services::DocumentService* document_manager = nullptr) :
|
||||
scheduler_(scheduler), lifecycle_callback_(lifecycle_callback), document_service_(document_manager) {}
|
||||
|
||||
scheduler::RequestScheduler* GetScheduler() const { return scheduler_; }
|
||||
|
||||
services::DocumentManager* GetDocumentManager() const { return document_manager_; }
|
||||
services::DocumentService* GetDocumentService() const { return document_service_; }
|
||||
|
||||
void TriggerLifecycleEvent(ServerLifecycleEvent event) const
|
||||
{
|
||||
|
|
@ -37,7 +37,7 @@ namespace lsp::providers
|
|||
private:
|
||||
scheduler::RequestScheduler* scheduler_;
|
||||
LifecycleCallback lifecycle_callback_;
|
||||
services::DocumentManager* document_manager_;
|
||||
services::DocumentService* document_service_;
|
||||
};
|
||||
|
||||
// LSP请求提供者接口基类
|
||||
|
|
|
|||
Loading…
Reference in New Issue