Switch to {Request,Notification}Message

This commit is contained in:
Fangrui Song 2018-01-19 00:56:09 -08:00
parent 148a8b3f20
commit 0e2b2cfb0c
17 changed files with 40 additions and 63 deletions

View File

@ -251,7 +251,7 @@ optional<lsTextEdit> BuildAutoImplementForFunction(QueryDatabase* db,
} }
struct Ipc_TextDocumentCodeAction struct Ipc_TextDocumentCodeAction
: public IpcMessage<Ipc_TextDocumentCodeAction> { : public RequestMessage<Ipc_TextDocumentCodeAction> {
const static IpcId kIpcId = IpcId::TextDocumentCodeAction; const static IpcId kIpcId = IpcId::TextDocumentCodeAction;
// Contains additional diagnostic information about the context in which // Contains additional diagnostic information about the context in which
// a code action is run. // a code action is run.
@ -268,8 +268,6 @@ struct Ipc_TextDocumentCodeAction
// Context carrying additional information. // Context carrying additional information.
lsCodeActionContext context; lsCodeActionContext context;
}; };
lsRequestId id;
lsCodeActionParams params; lsCodeActionParams params;
}; };
MAKE_REFLECT_STRUCT(Ipc_TextDocumentCodeAction::lsCodeActionContext, MAKE_REFLECT_STRUCT(Ipc_TextDocumentCodeAction::lsCodeActionContext,

View File

@ -36,9 +36,9 @@ void Reflect(Reader& visitor, lsCodeLensCommandArguments& value) {
#endif #endif
using TCodeLens = lsCodeLens<lsCodeLensUserData, lsCodeLensCommandArguments>; using TCodeLens = lsCodeLens<lsCodeLensUserData, lsCodeLensCommandArguments>;
struct Ipc_TextDocumentCodeLens : public IpcMessage<Ipc_TextDocumentCodeLens> { struct Ipc_TextDocumentCodeLens
: public RequestMessage<Ipc_TextDocumentCodeLens> {
const static IpcId kIpcId = IpcId::TextDocumentCodeLens; const static IpcId kIpcId = IpcId::TextDocumentCodeLens;
lsRequestId id;
lsDocumentCodeLensParams params; lsDocumentCodeLensParams params;
}; };
MAKE_REFLECT_STRUCT(Ipc_TextDocumentCodeLens, id, params); MAKE_REFLECT_STRUCT(Ipc_TextDocumentCodeLens, id, params);

View File

@ -45,10 +45,9 @@ struct lsCompletionParams : lsTextDocumentPositionParams {
}; };
MAKE_REFLECT_STRUCT(lsCompletionParams, textDocument, position, context); MAKE_REFLECT_STRUCT(lsCompletionParams, textDocument, position, context);
struct Ipc_TextDocumentComplete : public IpcMessage<Ipc_TextDocumentComplete> { struct Ipc_TextDocumentComplete
: public RequestMessage<Ipc_TextDocumentComplete> {
const static IpcId kIpcId = IpcId::TextDocumentCompletion; const static IpcId kIpcId = IpcId::TextDocumentCompletion;
lsRequestId id;
lsCompletionParams params; lsCompletionParams params;
}; };
MAKE_REFLECT_STRUCT(Ipc_TextDocumentComplete, id, params); MAKE_REFLECT_STRUCT(Ipc_TextDocumentComplete, id, params);

View File

@ -4,7 +4,7 @@
namespace { namespace {
struct Ipc_TextDocumentDidChange struct Ipc_TextDocumentDidChange
: public IpcMessage<Ipc_TextDocumentDidChange> { : public NotificationMessage<Ipc_TextDocumentDidChange> {
const static IpcId kIpcId = IpcId::TextDocumentDidChange; const static IpcId kIpcId = IpcId::TextDocumentDidChange;
lsTextDocumentDidChangeParams params; lsTextDocumentDidChangeParams params;
}; };

View File

@ -4,12 +4,12 @@
#include "working_files.h" #include "working_files.h"
namespace { namespace {
struct Ipc_TextDocumentDidClose : public IpcMessage<Ipc_TextDocumentDidClose> { struct Ipc_TextDocumentDidClose
: public NotificationMessage<Ipc_TextDocumentDidClose> {
const static IpcId kIpcId = IpcId::TextDocumentDidClose;
struct Params { struct Params {
lsTextDocumentIdentifier textDocument; lsTextDocumentIdentifier textDocument;
}; };
const static IpcId kIpcId = IpcId::TextDocumentDidClose;
Params params; Params params;
}; };
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidClose::Params, textDocument); MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidClose::Params, textDocument);

View File

@ -9,12 +9,12 @@
namespace { namespace {
// Open, view, change, close file // Open, view, change, close file
struct Ipc_TextDocumentDidOpen : public IpcMessage<Ipc_TextDocumentDidOpen> { struct Ipc_TextDocumentDidOpen
: public NotificationMessage<Ipc_TextDocumentDidOpen> {
const static IpcId kIpcId = IpcId::TextDocumentDidOpen;
struct Params { struct Params {
lsTextDocumentItem textDocument; lsTextDocumentItem textDocument;
}; };
const static IpcId kIpcId = IpcId::TextDocumentDidOpen;
Params params; Params params;
}; };
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidOpen::Params, textDocument); MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidOpen::Params, textDocument);

View File

@ -6,7 +6,9 @@
#include <loguru/loguru.hpp> #include <loguru/loguru.hpp>
namespace { namespace {
struct Ipc_TextDocumentDidSave : public IpcMessage<Ipc_TextDocumentDidSave> { struct Ipc_TextDocumentDidSave
: public NotificationMessage<Ipc_TextDocumentDidSave> {
const static IpcId kIpcId = IpcId::TextDocumentDidSave;
struct Params { struct Params {
// The document that was saved. // The document that was saved.
lsTextDocumentIdentifier textDocument; lsTextDocumentIdentifier textDocument;
@ -15,8 +17,6 @@ struct Ipc_TextDocumentDidSave : public IpcMessage<Ipc_TextDocumentDidSave> {
// when the save notifcation was requested. // when the save notifcation was requested.
// std::string text; // std::string text;
}; };
const static IpcId kIpcId = IpcId::TextDocumentDidSave;
Params params; Params params;
}; };
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidSave::Params, textDocument); MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidSave::Params, textDocument);

View File

@ -7,18 +7,15 @@
namespace { namespace {
struct Ipc_TextDocumentDocumentLink struct Ipc_TextDocumentDocumentLink
: public IpcMessage<Ipc_TextDocumentDocumentLink> { : public RequestMessage<Ipc_TextDocumentDocumentLink> {
const static IpcId kIpcId = IpcId::TextDocumentDocumentLink; const static IpcId kIpcId = IpcId::TextDocumentDocumentLink;
struct Params {
struct DocumentLinkParams {
// The document to provide document links for. // The document to provide document links for.
lsTextDocumentIdentifier textDocument; lsTextDocumentIdentifier textDocument;
}; };
Params params;
lsRequestId id;
DocumentLinkParams params;
}; };
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDocumentLink::DocumentLinkParams, MAKE_REFLECT_STRUCT(Ipc_TextDocumentDocumentLink::Params,
textDocument); textDocument);
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDocumentLink, id, params); MAKE_REFLECT_STRUCT(Ipc_TextDocumentDocumentLink, id, params);
REGISTER_IPC_MESSAGE(Ipc_TextDocumentDocumentLink); REGISTER_IPC_MESSAGE(Ipc_TextDocumentDocumentLink);

View File

@ -9,10 +9,8 @@ struct lsDocumentSymbolParams {
MAKE_REFLECT_STRUCT(lsDocumentSymbolParams, textDocument); MAKE_REFLECT_STRUCT(lsDocumentSymbolParams, textDocument);
struct Ipc_TextDocumentDocumentSymbol struct Ipc_TextDocumentDocumentSymbol
: public IpcMessage<Ipc_TextDocumentDocumentSymbol> { : public RequestMessage<Ipc_TextDocumentDocumentSymbol> {
const static IpcId kIpcId = IpcId::TextDocumentDocumentSymbol; const static IpcId kIpcId = IpcId::TextDocumentDocumentSymbol;
lsRequestId id;
lsDocumentSymbolParams params; lsDocumentSymbolParams params;
}; };
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDocumentSymbol, id, params); MAKE_REFLECT_STRUCT(Ipc_TextDocumentDocumentSymbol, id, params);

View File

@ -7,19 +7,16 @@
namespace { namespace {
struct lsTextDocumentFormattingParams { struct Ipc_TextDocumentFormatting
: public RequestMessage<Ipc_TextDocumentFormatting> {
const static IpcId kIpcId = IpcId::TextDocumentFormatting;
struct Params {
lsTextDocumentIdentifier textDocument; lsTextDocumentIdentifier textDocument;
lsFormattingOptions options; lsFormattingOptions options;
};
Params params;
}; };
MAKE_REFLECT_STRUCT(lsTextDocumentFormattingParams, textDocument, options); MAKE_REFLECT_STRUCT(Ipc_TextDocumentFormatting::Params, textDocument, options);
struct Ipc_TextDocumentFormatting
: public IpcMessage<Ipc_TextDocumentFormatting> {
const static IpcId kIpcId = IpcId::TextDocumentFormatting;
lsRequestId id;
lsTextDocumentFormattingParams params;
};
MAKE_REFLECT_STRUCT(Ipc_TextDocumentFormatting, id, params); MAKE_REFLECT_STRUCT(Ipc_TextDocumentFormatting, id, params);
REGISTER_IPC_MESSAGE(Ipc_TextDocumentFormatting); REGISTER_IPC_MESSAGE(Ipc_TextDocumentFormatting);

View File

@ -4,10 +4,8 @@
namespace { namespace {
struct Ipc_TextDocumentDocumentHighlight struct Ipc_TextDocumentDocumentHighlight
: public IpcMessage<Ipc_TextDocumentDocumentHighlight> { : public RequestMessage<Ipc_TextDocumentDocumentHighlight> {
const static IpcId kIpcId = IpcId::TextDocumentDocumentHighlight; const static IpcId kIpcId = IpcId::TextDocumentDocumentHighlight;
lsRequestId id;
lsTextDocumentPositionParams params; lsTextDocumentPositionParams params;
}; };
MAKE_REFLECT_STRUCT(Ipc_TextDocumentDocumentHighlight, id, params); MAKE_REFLECT_STRUCT(Ipc_TextDocumentDocumentHighlight, id, params);

View File

@ -38,10 +38,8 @@ std::pair<optional<std::string>, std::string> GetCommentsAndHover(
return {nullopt, ""}; return {nullopt, ""};
} }
struct Ipc_TextDocumentHover : public IpcMessage<Ipc_TextDocumentHover> { struct Ipc_TextDocumentHover : public RequestMessage<Ipc_TextDocumentHover> {
const static IpcId kIpcId = IpcId::TextDocumentHover; const static IpcId kIpcId = IpcId::TextDocumentHover;
lsRequestId id;
lsTextDocumentPositionParams params; lsTextDocumentPositionParams params;
}; };
MAKE_REFLECT_STRUCT(Ipc_TextDocumentHover, id, params); MAKE_REFLECT_STRUCT(Ipc_TextDocumentHover, id, params);

View File

@ -19,10 +19,8 @@ MAKE_REFLECT_STRUCT(lsTextDocumentRangeFormattingParams,
options); options);
struct Ipc_TextDocumentRangeFormatting struct Ipc_TextDocumentRangeFormatting
: public IpcMessage<Ipc_TextDocumentRangeFormatting> { : public RequestMessage<Ipc_TextDocumentRangeFormatting> {
const static IpcId kIpcId = IpcId::TextDocumentRangeFormatting; const static IpcId kIpcId = IpcId::TextDocumentRangeFormatting;
lsRequestId id;
lsTextDocumentRangeFormattingParams params; lsTextDocumentRangeFormattingParams params;
}; };
MAKE_REFLECT_STRUCT(Ipc_TextDocumentRangeFormatting, id, params); MAKE_REFLECT_STRUCT(Ipc_TextDocumentRangeFormatting, id, params);

View File

@ -49,7 +49,8 @@ lsWorkspaceEdit BuildWorkspaceEdit(QueryDatabase* db,
return edit; return edit;
} }
struct Ipc_TextDocumentRename : public IpcMessage<Ipc_TextDocumentRename> { struct Ipc_TextDocumentRename : public RequestMessage<Ipc_TextDocumentRename> {
const static IpcId kIpcId = IpcId::TextDocumentRename;
struct Params { struct Params {
// The document to format. // The document to format.
lsTextDocumentIdentifier textDocument; lsTextDocumentIdentifier textDocument;
@ -62,9 +63,6 @@ struct Ipc_TextDocumentRename : public IpcMessage<Ipc_TextDocumentRename> {
// appropriate message set. // appropriate message set.
std::string newName; std::string newName;
}; };
const static IpcId kIpcId = IpcId::TextDocumentRename;
lsRequestId id;
Params params; Params params;
}; };
MAKE_REFLECT_STRUCT(Ipc_TextDocumentRename::Params, MAKE_REFLECT_STRUCT(Ipc_TextDocumentRename::Params,

View File

@ -6,10 +6,8 @@
namespace { namespace {
struct Ipc_TextDocumentSignatureHelp struct Ipc_TextDocumentSignatureHelp
: public IpcMessage<Ipc_TextDocumentSignatureHelp> { : public RequestMessage<Ipc_TextDocumentSignatureHelp> {
const static IpcId kIpcId = IpcId::TextDocumentSignatureHelp; const static IpcId kIpcId = IpcId::TextDocumentSignatureHelp;
lsRequestId id;
lsTextDocumentPositionParams params; lsTextDocumentPositionParams params;
}; };
MAKE_REFLECT_STRUCT(Ipc_TextDocumentSignatureHelp, id, params); MAKE_REFLECT_STRUCT(Ipc_TextDocumentSignatureHelp, id, params);

View File

@ -22,7 +22,7 @@ struct lsDidChangeWatchedFilesParams {
MAKE_REFLECT_STRUCT(lsDidChangeWatchedFilesParams, changes); MAKE_REFLECT_STRUCT(lsDidChangeWatchedFilesParams, changes);
struct Ipc_WorkspaceDidChangeWatchedFiles struct Ipc_WorkspaceDidChangeWatchedFiles
: public IpcMessage<Ipc_WorkspaceDidChangeWatchedFiles> { : public NotificationMessage<Ipc_WorkspaceDidChangeWatchedFiles> {
const static IpcId kIpcId = IpcId::WorkspaceDidChangeWatchedFiles; const static IpcId kIpcId = IpcId::WorkspaceDidChangeWatchedFiles;
lsDidChangeWatchedFilesParams params; lsDidChangeWatchedFilesParams params;
}; };

View File

@ -39,16 +39,14 @@ bool InsertSymbolIntoResult(QueryDatabase* db,
return true; return true;
} }
struct lsWorkspaceSymbolParams { struct Ipc_WorkspaceSymbol : public RequestMessage<Ipc_WorkspaceSymbol> {
std::string query;
};
MAKE_REFLECT_STRUCT(lsWorkspaceSymbolParams, query);
struct Ipc_WorkspaceSymbol : public IpcMessage<Ipc_WorkspaceSymbol> {
const static IpcId kIpcId = IpcId::WorkspaceSymbol; const static IpcId kIpcId = IpcId::WorkspaceSymbol;
lsRequestId id; struct Params {
lsWorkspaceSymbolParams params; std::string query;
};
Params params;
}; };
MAKE_REFLECT_STRUCT(Ipc_WorkspaceSymbol::Params, query);
MAKE_REFLECT_STRUCT(Ipc_WorkspaceSymbol, id, params); MAKE_REFLECT_STRUCT(Ipc_WorkspaceSymbol, id, params);
REGISTER_IPC_MESSAGE(Ipc_WorkspaceSymbol); REGISTER_IPC_MESSAGE(Ipc_WorkspaceSymbol);