MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / SendNotification

Method SendNotification

CodeFormatServer/src/LanguageServer.cpp:45–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void LanguageServer::SendNotification(std::string_view method, std::shared_ptr<lsp::Serializable> param) {
46 auto json = nlohmann::json::object();
47 json["jsonrpc"] = "2.0";
48 json["method"] = method;
49 if (param != nullptr) {
50 json["params"] = param->Serialize();
51 } else {
52 json["params"] = nullptr;
53 }
54
55 if (_session) {
56 auto dumpResult = json.dump();
57 std::string message = util::format("Content-Length:{}\r\n\r\n", dumpResult.size());
58
59 message.append(dumpResult);
60 _session->Send(std::move(message));
61 }
62}
63
64void LanguageServer::SendRequest(std::string_view method, std::shared_ptr<lsp::Serializable> param) {
65 auto json = nlohmann::json::object();

Callers

nothing calls this directly

Calls 5

formatFunction · 0.50
SerializeMethod · 0.45
dumpMethod · 0.45
sizeMethod · 0.45
SendMethod · 0.45

Tested by

no test coverage detected