ccls/src/method.h

34 lines
889 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 = std::string;
extern const char* kMethodType_Unknown;
extern const char* kMethodType_Exit;
extern const char* kMethodType_TextDocumentPublishDiagnostics;
extern const char* kMethodType_CqueryPublishInactiveRegions;
extern const char* kMethodType_CqueryPublishSemanticHighlighting;
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();
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;
2018-03-22 05:01:21 +00:00
lsRequestId GetRequestId() const override;
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;
};