2018-08-21 05:27:52 +00:00
|
|
|
/* Copyright 2017-2018 ccls Authors
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
==============================================================================*/
|
|
|
|
|
2018-09-22 08:37:00 +00:00
|
|
|
#include "clang_complete.hh"
|
2018-01-20 19:34:37 +00:00
|
|
|
#include "match.h"
|
2018-10-28 17:49:31 +00:00
|
|
|
#include "message_handler.hh"
|
2018-08-09 17:08:14 +00:00
|
|
|
#include "pipeline.hh"
|
2018-10-28 17:49:31 +00:00
|
|
|
#include "project.hh"
|
2017-12-29 16:29:47 +00:00
|
|
|
#include "working_files.h"
|
2017-12-06 03:32:33 +00:00
|
|
|
|
2018-01-27 17:29:28 +00:00
|
|
|
#include <queue>
|
|
|
|
#include <unordered_set>
|
2017-12-06 03:32:33 +00:00
|
|
|
|
2018-10-28 17:49:31 +00:00
|
|
|
namespace ccls {
|
2017-12-06 05:03:38 +00:00
|
|
|
namespace {
|
2018-10-28 17:49:31 +00:00
|
|
|
struct Param {
|
|
|
|
bool dependencies = true;
|
|
|
|
std::vector<std::string> whitelist;
|
|
|
|
std::vector<std::string> blacklist;
|
2017-12-06 04:39:44 +00:00
|
|
|
};
|
2018-10-28 17:49:31 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Param, dependencies, whitelist, blacklist);
|
|
|
|
} // namespace
|
2017-12-06 04:39:44 +00:00
|
|
|
|
2018-10-28 17:49:31 +00:00
|
|
|
void MessageHandler::ccls_reload(Reader &reader) {
|
|
|
|
Param param;
|
|
|
|
Reflect(reader, param);
|
2018-09-12 06:31:06 +00:00
|
|
|
// Send index requests for every file.
|
2018-10-28 17:49:31 +00:00
|
|
|
if (param.whitelist.empty() && param.blacklist.empty()) {
|
|
|
|
vfs->Clear();
|
|
|
|
db->clear();
|
|
|
|
project->Index(working_files, lsRequestId());
|
|
|
|
clang_complete->FlushAllSessions();
|
|
|
|
return;
|
2017-12-06 03:32:33 +00:00
|
|
|
}
|
2018-10-28 17:49:31 +00:00
|
|
|
}
|
|
|
|
} // namespace ccls
|