2017-03-25 23:58:11 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "serializer.h"
|
2017-09-22 01:14:57 +00:00
|
|
|
#include "utils.h"
|
|
|
|
|
2017-03-25 23:58:11 +00:00
|
|
|
#include <string>
|
|
|
|
|
2018-03-25 18:21:42 +00:00
|
|
|
using MethodType = const char*;
|
2018-03-23 03:52:06 +00:00
|
|
|
extern MethodType kMethodType_Unknown;
|
|
|
|
extern MethodType kMethodType_Exit;
|
|
|
|
extern MethodType kMethodType_TextDocumentPublishDiagnostics;
|
2018-03-31 03:16:33 +00:00
|
|
|
extern MethodType kMethodType_CclsPublishInactiveRegions;
|
|
|
|
extern MethodType kMethodType_CclsPublishSemanticHighlighting;
|
2017-03-25 23:58:11 +00:00
|
|
|
|
2018-03-22 05:01:21 +00:00
|
|
|
using lsRequestId = std::variant<std::monostate, int64_t, std::string>;
|
|
|
|
|
|
|
|
struct InMessage {
|
2018-04-08 06:32:35 +00:00
|
|
|
virtual ~InMessage() = default;
|
2017-09-22 01:32:55 +00:00
|
|
|
|
2018-03-22 04:05:25 +00:00
|
|
|
virtual MethodType GetMethodType() const = 0;
|
2018-03-22 05:01:21 +00:00
|
|
|
virtual lsRequestId GetRequestId() const = 0;
|
2017-03-25 23:58:11 +00:00
|
|
|
};
|
|
|
|
|
2018-03-22 05:01:21 +00:00
|
|
|
struct RequestInMessage : public InMessage {
|
2018-03-22 04:05:25 +00:00
|
|
|
// number or string, actually no null
|
2018-01-19 08:47:52 +00:00
|
|
|
lsRequestId id;
|
2018-04-08 06:32:35 +00:00
|
|
|
lsRequestId GetRequestId() const override {
|
|
|
|
return id;
|
|
|
|
}
|
2018-01-19 08:47:52 +00:00
|
|
|
};
|
|
|
|
|
2018-03-22 05:01:21 +00:00
|
|
|
// NotificationInMessage does not have |id|.
|
|
|
|
struct NotificationInMessage : public InMessage {
|
2018-04-08 06:32:35 +00:00
|
|
|
lsRequestId GetRequestId() const override {
|
|
|
|
return std::monostate();
|
|
|
|
}
|
2018-03-22 05:01:21 +00:00
|
|
|
};
|