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>
|
|
|
|
|
|
|
|
enum class IpcId : int {
|
|
|
|
// Language server specific requests.
|
|
|
|
CancelRequest = 0,
|
|
|
|
Initialize,
|
|
|
|
Initialized,
|
2017-05-03 06:45:10 +00:00
|
|
|
Exit,
|
2017-03-26 06:47:59 +00:00
|
|
|
TextDocumentDidOpen,
|
|
|
|
TextDocumentDidChange,
|
|
|
|
TextDocumentDidClose,
|
2017-04-10 00:08:54 +00:00
|
|
|
TextDocumentDidSave,
|
2017-05-10 06:13:13 +00:00
|
|
|
TextDocumentPublishDiagnostics,
|
2017-04-14 08:21:03 +00:00
|
|
|
TextDocumentRename,
|
2017-03-26 06:47:59 +00:00
|
|
|
TextDocumentCompletion,
|
2017-05-15 07:28:53 +00:00
|
|
|
TextDocumentSignatureHelp,
|
2017-04-03 02:21:21 +00:00
|
|
|
TextDocumentDefinition,
|
2017-04-14 06:43:50 +00:00
|
|
|
TextDocumentDocumentHighlight,
|
2017-04-14 05:18:02 +00:00
|
|
|
TextDocumentHover,
|
2017-12-25 13:08:36 +00:00
|
|
|
TextDocumentFormatting,
|
2017-12-31 22:52:06 +00:00
|
|
|
TextDocumentRangeFormatting,
|
|
|
|
TextDocumentOnTypeFormatting,
|
2017-04-10 05:34:06 +00:00
|
|
|
TextDocumentReferences,
|
2017-03-25 23:58:11 +00:00
|
|
|
TextDocumentDocumentSymbol,
|
2017-05-21 04:30:59 +00:00
|
|
|
TextDocumentDocumentLink,
|
2017-05-20 19:31:07 +00:00
|
|
|
TextDocumentCodeAction,
|
2017-03-25 23:58:11 +00:00
|
|
|
TextDocumentCodeLens,
|
|
|
|
CodeLensResolve,
|
|
|
|
WorkspaceSymbol,
|
|
|
|
|
2017-05-20 21:45:46 +00:00
|
|
|
// Custom notifications
|
2017-12-03 22:35:22 +00:00
|
|
|
// Comes from the client. Does various things, like update semantic
|
|
|
|
// highlighting.
|
|
|
|
CqueryTextDocumentDidView,
|
2017-05-20 21:45:46 +00:00
|
|
|
CqueryPublishInactiveRegions,
|
2017-11-09 07:06:32 +00:00
|
|
|
CqueryPublishSemanticHighlighting,
|
2017-05-20 21:45:46 +00:00
|
|
|
|
2017-04-21 04:50:31 +00:00
|
|
|
// Custom messages
|
|
|
|
CqueryFreshenIndex,
|
2017-05-24 07:17:29 +00:00
|
|
|
// Messages used in tree views.
|
|
|
|
CqueryTypeHierarchyTree,
|
|
|
|
CqueryCallTreeInitial,
|
|
|
|
CqueryCallTreeExpand,
|
2017-05-07 06:56:04 +00:00
|
|
|
// These are like DocumentReferences but show different types of data.
|
2017-09-22 01:14:57 +00:00
|
|
|
CqueryVars, // Show all variables of a type.
|
|
|
|
CqueryCallers, // Show all callers of a function.
|
|
|
|
CqueryBase, // Show base types/method.
|
|
|
|
CqueryDerived, // Show all derived types/methods.
|
2017-05-07 06:56:04 +00:00
|
|
|
|
2017-03-25 23:58:11 +00:00
|
|
|
// Internal implementation detail.
|
2017-12-04 08:16:19 +00:00
|
|
|
Unknown,
|
2017-09-13 03:35:27 +00:00
|
|
|
|
|
|
|
// Index the given file contents. Used in tests.
|
|
|
|
CqueryIndexFile,
|
2017-12-28 16:55:46 +00:00
|
|
|
// Wait until all cquery threads are idle. Used in tests.
|
|
|
|
CqueryWait,
|
2017-03-25 23:58:11 +00:00
|
|
|
};
|
|
|
|
MAKE_ENUM_HASHABLE(IpcId)
|
|
|
|
MAKE_REFLECT_TYPE_PROXY(IpcId, int)
|
|
|
|
const char* IpcIdToString(IpcId id);
|
|
|
|
|
|
|
|
struct BaseIpcMessage {
|
|
|
|
const IpcId method_id;
|
|
|
|
BaseIpcMessage(IpcId method_id);
|
2017-06-09 06:20:29 +00:00
|
|
|
virtual ~BaseIpcMessage();
|
2017-09-22 01:32:55 +00:00
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
T* As() {
|
|
|
|
assert(method_id == T::kIpcId);
|
|
|
|
return static_cast<T*>(this);
|
|
|
|
}
|
2017-03-25 23:58:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct IpcMessage : public BaseIpcMessage {
|
|
|
|
IpcMessage() : BaseIpcMessage(T::kIpcId) {}
|
2017-12-25 13:08:36 +00:00
|
|
|
};
|