ccls/src/method.h

38 lines
944 B
C
Raw Normal View History

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>
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 {
virtual ~InMessage() = default;
2017-09-22 01:32:55 +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 {
// number or string, actually no null
2018-01-19 08:47:52 +00:00
lsRequestId id;
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 {
lsRequestId GetRequestId() const override {
return std::monostate();
}
2018-03-22 05:01:21 +00:00
};