mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-24 16:45:07 +00:00
38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
#include "cache_manager.h"
|
|
#include "message_handler.h"
|
|
#include "platform.h"
|
|
#include "queue_manager.h"
|
|
|
|
#include <loguru/loguru.hpp>
|
|
|
|
namespace {
|
|
struct Ipc_CqueryIndexFile : public NotificationMessage<Ipc_CqueryIndexFile> {
|
|
static constexpr IpcId kIpcId = IpcId::CqueryIndexFile;
|
|
struct Params {
|
|
std::string path;
|
|
std::vector<std::string> args;
|
|
bool is_interactive = false;
|
|
std::string contents;
|
|
};
|
|
Params params;
|
|
};
|
|
MAKE_REFLECT_STRUCT(Ipc_CqueryIndexFile::Params,
|
|
path,
|
|
args,
|
|
is_interactive,
|
|
contents);
|
|
MAKE_REFLECT_STRUCT(Ipc_CqueryIndexFile, params);
|
|
REGISTER_IPC_MESSAGE(Ipc_CqueryIndexFile);
|
|
|
|
struct CqueryIndexFileHandler : BaseMessageHandler<Ipc_CqueryIndexFile> {
|
|
void Run(Ipc_CqueryIndexFile* request) override {
|
|
LOG_S(INFO) << "Indexing file " << request->params.path;
|
|
QueueManager::instance()->index_request.PushBack(
|
|
Index_Request(NormalizePath(request->params.path), request->params.args,
|
|
request->params.is_interactive, request->params.contents,
|
|
ICacheManager::Make(config)));
|
|
}
|
|
};
|
|
REGISTER_MESSAGE_HANDLER(CqueryIndexFileHandler);
|
|
} // namespace
|