mirror of
https://github.com/MaskRay/ccls.git
synced 2025-03-25 09:57:48 +00:00
41 lines
1.3 KiB
C++
41 lines
1.3 KiB
C++
#include "cache_manager.h"
|
|
#include "message_handler.h"
|
|
#include "platform.h"
|
|
#include "queue_manager.h"
|
|
|
|
#include <loguru/loguru.hpp>
|
|
|
|
namespace {
|
|
MethodType kMethodType = "$ccls/indexFile";
|
|
|
|
struct In_CclsIndexFile : public NotificationInMessage {
|
|
MethodType GetMethodType() const override { return kMethodType; }
|
|
struct Params {
|
|
std::string path;
|
|
std::vector<std::string> args;
|
|
bool is_interactive = false;
|
|
std::string contents;
|
|
};
|
|
Params params;
|
|
};
|
|
MAKE_REFLECT_STRUCT(In_CclsIndexFile::Params,
|
|
path,
|
|
args,
|
|
is_interactive,
|
|
contents);
|
|
MAKE_REFLECT_STRUCT(In_CclsIndexFile, params);
|
|
REGISTER_IN_MESSAGE(In_CclsIndexFile);
|
|
|
|
struct Handler_CclsIndexFile : BaseMessageHandler<In_CclsIndexFile> {
|
|
MethodType GetMethodType() const override { return kMethodType; }
|
|
void Run(In_CclsIndexFile* 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()));
|
|
}
|
|
};
|
|
REGISTER_MESSAGE_HANDLER(Handler_CclsIndexFile);
|
|
} // namespace
|