Move src/messages/*.cc to anonymous namespace

This commit is contained in:
Jacob Dufault 2017-12-05 21:03:38 -08:00
parent b65a30c3f7
commit 7a5eb3c4d5
29 changed files with 62 additions and 11 deletions

View File

@ -1,6 +1,7 @@
#include "message_handler.h"
#include "query_utils.h"
namespace {
struct Ipc_CqueryBase : public IpcMessage<Ipc_CqueryBase> {
const static IpcId kIpcId = IpcId::CqueryBase;
lsRequestId id;
@ -47,4 +48,5 @@ struct CqueryBaseHandler : BaseMessageHandler<Ipc_CqueryBase> {
IpcManager::WriteStdout(IpcId::CqueryBase, out);
}
};
REGISTER_MESSAGE_HANDLER(CqueryBaseHandler);
REGISTER_MESSAGE_HANDLER(CqueryBaseHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h"
#include "query_utils.h"
namespace {
struct Ipc_CqueryCallTreeInitial
: public IpcMessage<Ipc_CqueryCallTreeInitial> {
const static IpcId kIpcId = IpcId::CqueryCallTreeInitial;
@ -215,3 +216,4 @@ struct CqueryCallTreeExpandHandler
}
};
REGISTER_MESSAGE_HANDLER(CqueryCallTreeExpandHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h"
#include "query_utils.h"
namespace {
struct Ipc_CqueryCallers : public IpcMessage<Ipc_CqueryCallers> {
const static IpcId kIpcId = IpcId::CqueryCallers;
lsRequestId id;
@ -39,4 +40,5 @@ struct CqueryCallersHandler : BaseMessageHandler<Ipc_CqueryCallers> {
IpcManager::WriteStdout(IpcId::CqueryCallers, out);
}
};
REGISTER_MESSAGE_HANDLER(CqueryCallersHandler);
REGISTER_MESSAGE_HANDLER(CqueryCallersHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h"
#include "query_utils.h"
namespace {
struct Ipc_CqueryDerived : public IpcMessage<Ipc_CqueryDerived> {
const static IpcId kIpcId = IpcId::CqueryDerived;
lsRequestId id;
@ -39,4 +40,5 @@ struct CqueryDerivedHandler : BaseMessageHandler<Ipc_CqueryDerived> {
IpcManager::WriteStdout(IpcId::CqueryDerived, out);
}
};
REGISTER_MESSAGE_HANDLER(CqueryDerivedHandler);
REGISTER_MESSAGE_HANDLER(CqueryDerivedHandler);
} // namespace

View File

@ -1,5 +1,6 @@
#include "message_handler.h"
namespace {
struct Ipc_CqueryTextDocumentDidView
: public IpcMessage<Ipc_CqueryTextDocumentDidView> {
struct Params {
@ -33,3 +34,4 @@ struct CqueryDidViewHandler
}
};
REGISTER_MESSAGE_HANDLER(CqueryDidViewHandler);
} // namespace

View File

@ -3,6 +3,7 @@
#include <loguru.hpp>
namespace {
struct Ipc_CqueryExitWhenIdle : public IpcMessage<Ipc_CqueryExitWhenIdle> {
static constexpr IpcId kIpcId = IpcId::CqueryExitWhenIdle;
};
@ -16,4 +17,5 @@ struct CqueryExitWhenIdleHandler : MessageHandler {
WorkThread::request_exit_on_idle = true;
}
};
REGISTER_MESSAGE_HANDLER(CqueryExitWhenIdleHandler);
REGISTER_MESSAGE_HANDLER(CqueryExitWhenIdleHandler);
} // namespace

View File

@ -3,6 +3,7 @@
#include <loguru.hpp>
namespace {
struct Ipc_CqueryFreshenIndex : public IpcMessage<Ipc_CqueryFreshenIndex> {
const static IpcId kIpcId = IpcId::CqueryFreshenIndex;
lsRequestId id;
@ -49,3 +50,4 @@ struct CqueryFreshenIndexHandler : MessageHandler {
}
};
REGISTER_MESSAGE_HANDLER(CqueryFreshenIndexHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h"
#include "platform.h"
namespace {
struct Ipc_CqueryIndexFile : public IpcMessage<Ipc_CqueryIndexFile> {
static constexpr IpcId kIpcId = IpcId::CqueryIndexFile;
@ -28,3 +29,4 @@ struct CqueryIndexFileHandler : BaseMessageHandler<Ipc_CqueryIndexFile> {
}
};
REGISTER_MESSAGE_HANDLER(CqueryIndexFileHandler);
} // namespace

View File

@ -3,6 +3,7 @@
#include <loguru.hpp>
namespace {
struct Ipc_CqueryQueryDbWaitForIdleIndexer
: public IpcMessage<Ipc_CqueryQueryDbWaitForIdleIndexer> {
static constexpr IpcId kIpcId = IpcId::CqueryQueryDbWaitForIdleIndexer;
@ -36,4 +37,5 @@ struct CqueryQueryDbWaitForIdleIndexerHandler : MessageHandler {
LOG_S(INFO) << "Done waiting for idle";
}
};
REGISTER_MESSAGE_HANDLER(CqueryQueryDbWaitForIdleIndexerHandler);
REGISTER_MESSAGE_HANDLER(CqueryQueryDbWaitForIdleIndexerHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h"
#include "query_utils.h"
namespace {
struct Ipc_CqueryTypeHierarchyTree
: public IpcMessage<Ipc_CqueryTypeHierarchyTree> {
const static IpcId kIpcId = IpcId::CqueryTypeHierarchyTree;
@ -188,4 +189,5 @@ struct CqueryTypeHierarchyTreeHandler
IpcManager::WriteStdout(IpcId::CqueryTypeHierarchyTree, out);
}
};
REGISTER_MESSAGE_HANDLER(CqueryTypeHierarchyTreeHandler);
REGISTER_MESSAGE_HANDLER(CqueryTypeHierarchyTreeHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h"
#include "query_utils.h"
namespace {
struct Ipc_CqueryVars : public IpcMessage<Ipc_CqueryVars> {
const static IpcId kIpcId = IpcId::CqueryVars;
lsRequestId id;
@ -34,4 +35,5 @@ struct CqueryVarsHandler : BaseMessageHandler<Ipc_CqueryVars> {
IpcManager::WriteStdout(IpcId::CqueryVars, out);
}
};
REGISTER_MESSAGE_HANDLER(CqueryVarsHandler);
REGISTER_MESSAGE_HANDLER(CqueryVarsHandler);
} // namespace

View File

@ -2,6 +2,7 @@
#include <loguru.hpp>
namespace {
struct Ipc_Exit : public IpcMessage<Ipc_Exit> {
static const IpcId kIpcId = IpcId::Exit;
};
@ -17,3 +18,4 @@ struct ExitHandler : MessageHandler {
}
};
REGISTER_MESSAGE_HANDLER(ExitHandler);
} // namespace

View File

@ -5,6 +5,7 @@
#include <loguru.hpp>
namespace {
struct Ipc_InitializeRequest : public IpcMessage<Ipc_InitializeRequest> {
const static IpcId kIpcId = IpcId::Initialize;
@ -202,3 +203,4 @@ struct InitializeHandler : BaseMessageHandler<Ipc_InitializeRequest> {
}
};
REGISTER_MESSAGE_HANDLER(InitializeHandler);
} // namespace

View File

@ -247,8 +247,6 @@ optional<lsTextEdit> BuildAutoImplementForFunction(QueryDatabase* db,
return nullopt;
}
} // namespace
struct Ipc_TextDocumentCodeAction
: public IpcMessage<Ipc_TextDocumentCodeAction> {
const static IpcId kIpcId = IpcId::TextDocumentCodeAction;
@ -593,3 +591,4 @@ TEST_SUITE("FindIncludeLine") {
REQUIRE(FindIncludeLine(lines, "#include <e>") == 7);
}
}
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h"
#include "query_utils.h"
namespace {
struct lsDocumentCodeLensParams {
lsTextDocumentIdentifier textDocument;
};
@ -252,3 +253,4 @@ struct TextDocumentCodeLensHandler
}
};
REGISTER_MESSAGE_HANDLER(TextDocumentCodeLensHandler);
} // namespace

View File

@ -7,7 +7,6 @@ void PushBack(NonElidedVector<lsLocation>* result,
if (location)
result->push_back(*location);
}
} // namespace
struct Ipc_TextDocumentDefinition
: public IpcMessage<Ipc_TextDocumentDefinition> {
@ -112,3 +111,4 @@ struct TextDocumentDefinitionHandler
}
};
REGISTER_MESSAGE_HANDLER(TextDocumentDefinitionHandler);
} // namespace

View File

@ -1,5 +1,6 @@
#include "message_handler.h"
namespace {
struct Ipc_TextDocumentDidChange
: public IpcMessage<Ipc_TextDocumentDidChange> {
const static IpcId kIpcId = IpcId::TextDocumentDidChange;
@ -20,3 +21,4 @@ struct TextDocumentDidChangeHandler
}
};
REGISTER_MESSAGE_HANDLER(TextDocumentDidChangeHandler);
} // namespace

View File

@ -1,5 +1,6 @@
#include "message_handler.h"
namespace {
struct Ipc_TextDocumentDidClose : public IpcMessage<Ipc_TextDocumentDidClose> {
struct Params {
lsTextDocumentItem textDocument;
@ -28,3 +29,4 @@ struct TextDocumentDidCloseHandler
}
};
REGISTER_MESSAGE_HANDLER(TextDocumentDidCloseHandler);
} // namespace

View File

@ -2,6 +2,7 @@
#include "message_handler.h"
#include "timer.h"
namespace {
// Open, view, change, close file
struct Ipc_TextDocumentDidOpen : public IpcMessage<Ipc_TextDocumentDidOpen> {
struct Params {
@ -53,3 +54,4 @@ struct TextDocumentDidOpenHandler
}
};
REGISTER_MESSAGE_HANDLER(TextDocumentDidOpenHandler);
} // namespace

View File

@ -1,5 +1,6 @@
#include "message_handler.h"
namespace {
struct Ipc_TextDocumentDidSave : public IpcMessage<Ipc_TextDocumentDidSave> {
struct Params {
// The document that was saved.
@ -42,3 +43,4 @@ struct TextDocumentDidSaveHandler
}
};
REGISTER_MESSAGE_HANDLER(TextDocumentDidSaveHandler);
} // namespace

View File

@ -3,6 +3,7 @@
#include <loguru.hpp>
namespace {
struct Ipc_TextDocumentDocumentLink
: public IpcMessage<Ipc_TextDocumentDocumentLink> {
const static IpcId kIpcId = IpcId::TextDocumentDocumentLink;
@ -83,3 +84,4 @@ struct TextDocumentDocumentLinkHandler
}
};
REGISTER_MESSAGE_HANDLER(TextDocumentDocumentLinkHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h"
#include "query_utils.h"
namespace {
struct lsDocumentSymbolParams {
lsTextDocumentIdentifier textDocument;
};
@ -52,3 +53,4 @@ struct TextDocumentDocumentSymbolHandler
}
};
REGISTER_MESSAGE_HANDLER(TextDocumentDocumentSymbolHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h"
#include "query_utils.h"
namespace {
struct Ipc_TextDocumentDocumentHighlight
: public IpcMessage<Ipc_TextDocumentDocumentHighlight> {
const static IpcId kIpcId = IpcId::TextDocumentDocumentHighlight;
@ -61,3 +62,4 @@ struct TextDocumentDocumentHighlightHandler
}
};
REGISTER_MESSAGE_HANDLER(TextDocumentDocumentHighlightHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h"
#include "query_utils.h"
namespace {
struct Ipc_TextDocumentHover : public IpcMessage<Ipc_TextDocumentHover> {
const static IpcId kIpcId = IpcId::TextDocumentHover;
@ -55,3 +56,4 @@ struct TextDocumentHoverHandler : BaseMessageHandler<Ipc_TextDocumentHover> {
}
};
REGISTER_MESSAGE_HANDLER(TextDocumentHoverHandler);
} // namespace

View File

@ -3,6 +3,7 @@
#include <loguru.hpp>
namespace {
struct Ipc_TextDocumentReferences
: public IpcMessage<Ipc_TextDocumentReferences> {
struct lsReferenceContext {
@ -78,3 +79,4 @@ struct TextDocumentReferencesHandler
}
};
REGISTER_MESSAGE_HANDLER(TextDocumentReferencesHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h"
#include "query_utils.h"
namespace {
struct Ipc_TextDocumentRename : public IpcMessage<Ipc_TextDocumentRename> {
struct Params {
// The document to format.
@ -61,3 +62,4 @@ struct TextDocumentRenameHandler : BaseMessageHandler<Ipc_TextDocumentRename> {
}
};
REGISTER_MESSAGE_HANDLER(TextDocumentRenameHandler);
} // namespace

View File

@ -1,6 +1,7 @@
#include "message_handler.h"
#include "timer.h"
namespace {
struct Ipc_TextDocumentSignatureHelp
: public IpcMessage<Ipc_TextDocumentSignatureHelp> {
const static IpcId kIpcId = IpcId::TextDocumentSignatureHelp;
@ -161,3 +162,4 @@ struct TextDocumentSignatureHelpHandler : MessageHandler {
}
};
REGISTER_MESSAGE_HANDLER(TextDocumentSignatureHelpHandler);
} // namespace

View File

@ -4,6 +4,7 @@
#include <loguru.hpp>
namespace {
struct lsWorkspaceSymbolParams {
std::string query;
};
@ -73,3 +74,4 @@ struct WorkspaceSymbolHandler : BaseMessageHandler<Ipc_WorkspaceSymbol> {
}
};
REGISTER_MESSAGE_HANDLER(WorkspaceSymbolHandler);
} // namespace

View File

@ -31,7 +31,7 @@ struct IndexFile;
template <typename TVisitor> \
void Reflect(TVisitor& visitor, type& value) { \
auto value0 = static_cast<as_type>(value); \
Reflect(visitor, value0); \
::Reflect(visitor, value0); \
value = static_cast<type>(value0); \
}