tree-sitter test
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
#include <spdlog/spdlog.h>
|
||||
#include "./did_change_provider.hpp"
|
||||
#include "../../protocol/protocol.hpp"
|
||||
#include "../../protocol/transform/facade.hpp"
|
||||
#include "../../services/document.hpp"
|
||||
|
||||
namespace lsp::providers::text_document
|
||||
{
|
||||
@@ -16,8 +19,12 @@ namespace lsp::providers::text_document
|
||||
|
||||
void DidChangeProvider::HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context)
|
||||
{
|
||||
static_cast<void>(context);
|
||||
spdlog::debug("DidChangeProvider: Providing response for method {}", notification.method);
|
||||
|
||||
protocol::DidChangeTextDocumentParams did_change_text_document_params = transform::As<protocol::DidChangeTextDocumentParams>(notification.params.value());
|
||||
|
||||
services::DocumentService& document_service = context.GetService<services::DocumentService>();
|
||||
document_service.UpdateDocument(did_change_text_document_params);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#include <spdlog/spdlog.h>
|
||||
#include "./did_close_provider.hpp"
|
||||
#include "../../protocol/protocol.hpp"
|
||||
#include "../../protocol/transform/facade.hpp"
|
||||
#include "../../services/document.hpp"
|
||||
|
||||
namespace lsp::providers::text_document
|
||||
{
|
||||
|
||||
std::string DidCloseProvider::GetMethod() const
|
||||
{
|
||||
return "textDocument/didClose";
|
||||
}
|
||||
|
||||
std::string DidCloseProvider::GetProviderName() const
|
||||
{
|
||||
return "DidCloseProvider";
|
||||
}
|
||||
|
||||
void DidCloseProvider::HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context)
|
||||
{
|
||||
spdlog::debug("DidCloseProvider: Providing response for method {}", notification.method);
|
||||
|
||||
protocol::DidCloseTextDocumentParams did_close_text_document_params = transform::As<protocol::DidCloseTextDocumentParams>(notification.params.value());
|
||||
|
||||
services::DocumentService& document_service = context.GetService<services::DocumentService>();
|
||||
document_service.CloseDocument(did_close_text_document_params);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "../base/provider_interface.hpp"
|
||||
|
||||
namespace lsp::providers::text_document
|
||||
{
|
||||
class DidCloseProvider : public INotificationProvider
|
||||
{
|
||||
public:
|
||||
DidCloseProvider() = default;
|
||||
std::string GetMethod() const override;
|
||||
std::string GetProviderName() const override;
|
||||
void HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context) override;
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <spdlog/spdlog.h>
|
||||
#include "./did_open_provider.hpp"
|
||||
#include "../../services/document.hpp"
|
||||
#include "../../protocol/transform/facade.hpp"
|
||||
|
||||
namespace lsp::providers::text_document
|
||||
{
|
||||
@@ -15,8 +17,23 @@ namespace lsp::providers::text_document
|
||||
|
||||
void DidOpenProvider::HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context)
|
||||
{
|
||||
static_cast<void>(context);
|
||||
spdlog::debug("DidOpenProvider: Providing response for method {}", notification.method);
|
||||
|
||||
protocol::DidOpenTextDocumentParams did_open_text_document_params = transform::As<protocol::DidOpenTextDocumentParams>(notification.params.value());
|
||||
|
||||
services::DocumentService& document_service = context.GetService<services::DocumentService>();
|
||||
document_service.OpenDocument(did_open_text_document_params);
|
||||
|
||||
/*
|
||||
if (auto* symbolService = context.TryGetService<SymbolService>()) {
|
||||
symbolService->parseDocument(uri, content);
|
||||
}
|
||||
|
||||
// 3. 触发诊断
|
||||
if (auto* diagnosticService = context.TryGetService<DiagnosticService>()) {
|
||||
diagnosticService->diagnose(uri);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user