Debian Codegraph @

LspCpp/include/LibLsp/JsonRpc/message.h

raw
1 #pragma once
2
3 #include <atomic>
4 #include <string>
5 #include <iostream>
6 #include <LibLsp/JsonRpc/serializer.h>
7 #include "LibLsp/lsp/method_type.h"
8
9 struct LspMessage
10 {
11 public:
12 std::string jsonrpc = "2.0";
13 virtual void ReflectWriter(Writer&) = 0;
14
15 // Send the message to the language client by writing it to stdout.
16 void Write(std::ostream& out);
17
18 virtual MethodType GetMethodType() const = 0;
19 virtual void SetMethodType(MethodType) = 0;
20
21 virtual ~LspMessage() = default;
22 enum Kind
23 {
24 REQUEST_MESSAGE,
25 RESPONCE_MESSAGE,
26 NOTIFICATION_MESSAGE
27 };
28
29 virtual Kind GetKid() = 0;
30 virtual std::string ToJson();
31 };