ccls/src/messages/workspace_did_change_configuration.cc

45 lines
1.5 KiB
C++
Raw Normal View History

#include "cache_manager.h"
#include "clang_complete.h"
#include "message_handler.h"
#include "project.h"
#include "queue_manager.h"
#include "timer.h"
#include "working_files.h"
#include <loguru.hpp>
namespace {
struct lsDidChangeConfigurationParams {
bool placeholder;
};
MAKE_REFLECT_STRUCT(lsDidChangeConfigurationParams, placeholder);
struct Ipc_WorkspaceDidChangeConfiguration
: public NotificationMessage<Ipc_WorkspaceDidChangeConfiguration> {
const static IpcId kIpcId = IpcId::WorkspaceDidChangeConfiguration;
lsDidChangeConfigurationParams params;
};
MAKE_REFLECT_STRUCT(Ipc_WorkspaceDidChangeConfiguration, params);
REGISTER_IPC_MESSAGE(Ipc_WorkspaceDidChangeConfiguration);
struct WorkspaceDidChangeConfigurationHandler
: BaseMessageHandler<Ipc_WorkspaceDidChangeConfiguration> {
void Run(Ipc_WorkspaceDidChangeConfiguration* request) override {
Timer time;
project->Load(config, config->projectRoot);
time.ResetAndPrint("[perf] Loaded compilation entries (" +
2018-03-20 02:51:42 +00:00
std::to_string(project->entries.size()) + " files)");
time.Reset();
project->Index(config, QueueManager::instance(), working_files,
2018-03-20 02:51:42 +00:00
std::monostate());
time.ResetAndPrint(
"[perf] Dispatched workspace/didChangeConfiguration index requests");
clang_complete->FlushAllSessions();
LOG_S(INFO) << "Flushed all clang complete sessions";
}
};
REGISTER_MESSAGE_HANDLER(WorkspaceDidChangeConfigurationHandler);
} // namespace