2018-03-02 02:06:48 +00:00
|
|
|
#include "cache_manager.h"
|
2018-03-20 12:33:02 +00:00
|
|
|
#include "clang_complete.h"
|
2018-03-02 02:06:48 +00:00
|
|
|
#include "message_handler.h"
|
|
|
|
#include "project.h"
|
|
|
|
#include "queue_manager.h"
|
2018-03-11 22:12:26 +00:00
|
|
|
#include "timer.h"
|
2018-03-02 02:06:48 +00:00
|
|
|
#include "working_files.h"
|
|
|
|
|
2018-03-20 12:33:02 +00:00
|
|
|
#include <loguru.hpp>
|
|
|
|
|
2018-03-02 02:06:48 +00:00
|
|
|
namespace {
|
2018-03-22 04:05:25 +00:00
|
|
|
MethodType kMethodType = "workspace/didChangeConfiguration";
|
|
|
|
|
2018-03-02 02:06:48 +00:00
|
|
|
struct lsDidChangeConfigurationParams {
|
|
|
|
bool placeholder;
|
|
|
|
};
|
|
|
|
MAKE_REFLECT_STRUCT(lsDidChangeConfigurationParams, placeholder);
|
|
|
|
|
2018-03-22 05:01:21 +00:00
|
|
|
struct In_WorkspaceDidChangeConfiguration : public NotificationInMessage {
|
2018-03-22 04:05:25 +00:00
|
|
|
MethodType GetMethodType() const override { return kMethodType; }
|
2018-03-02 02:06:48 +00:00
|
|
|
lsDidChangeConfigurationParams params;
|
|
|
|
};
|
2018-03-22 04:05:25 +00:00
|
|
|
MAKE_REFLECT_STRUCT(In_WorkspaceDidChangeConfiguration, params);
|
|
|
|
REGISTER_IN_MESSAGE(In_WorkspaceDidChangeConfiguration);
|
2018-03-02 02:06:48 +00:00
|
|
|
|
2018-03-22 04:05:25 +00:00
|
|
|
struct Handler_WorkspaceDidChangeConfiguration
|
|
|
|
: BaseMessageHandler<In_WorkspaceDidChangeConfiguration> {
|
|
|
|
MethodType GetMethodType() const override { return kMethodType; }
|
|
|
|
void Run(In_WorkspaceDidChangeConfiguration* request) override {
|
2018-03-11 22:12:26 +00:00
|
|
|
Timer time;
|
2018-04-04 06:05:41 +00:00
|
|
|
project->Load(g_config->projectRoot);
|
2018-03-11 22:12:26 +00:00
|
|
|
time.ResetAndPrint("[perf] Loaded compilation entries (" +
|
2018-03-20 02:51:42 +00:00
|
|
|
std::to_string(project->entries.size()) + " files)");
|
2018-03-11 22:12:26 +00:00
|
|
|
|
|
|
|
time.Reset();
|
2018-04-16 19:36:02 +00:00
|
|
|
project->Index(QueueManager::instance(), working_files, lsRequestId());
|
2018-03-11 22:12:26 +00:00
|
|
|
time.ResetAndPrint(
|
|
|
|
"[perf] Dispatched workspace/didChangeConfiguration index requests");
|
2018-03-20 12:33:02 +00:00
|
|
|
|
|
|
|
clang_complete->FlushAllSessions();
|
|
|
|
LOG_S(INFO) << "Flushed all clang complete sessions";
|
2018-03-02 02:06:48 +00:00
|
|
|
}
|
|
|
|
};
|
2018-03-22 04:05:25 +00:00
|
|
|
REGISTER_MESSAGE_HANDLER(Handler_WorkspaceDidChangeConfiguration);
|
2018-03-02 02:06:48 +00:00
|
|
|
} // namespace
|