tsl-devkit/lsp-server/src/provider/text_document/did_close.cpp

32 lines
1.0 KiB
C++

#include <spdlog/spdlog.h>
#include "./did_close.hpp"
#include "../../protocol/transform/facade.hpp"
#include "../../service/document.hpp"
namespace lsp::providers::text_document
{
std::string DidClose::GetMethod() const
{
return "textDocument/didClose";
}
std::string DidClose::GetProviderName() const
{
return "TextDocumentDidClose";
}
void DidClose::HandleNotification(const protocol::NotificationMessage& notification, ExecutionContext& context)
{
spdlog::debug("TextDocumentDidCloseProvider: Providing response for method {}", notification.method);
protocol::DidCloseTextDocumentParams did_close_text_document_params = transform::As<protocol::DidCloseTextDocumentParams>(notification.params.value());
service::Document& document_service = context.GetService<service::Document>();
document_service.CloseDocument(did_close_text_document_params);
spdlog::info("Document closed: {}", did_close_text_document_params.textDocument.uri);
}
}