mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-30 11:27:07 +00:00
Filter deps with index.blacklist
. (#64)
This commit is contained in:
parent
1ae97c64ed
commit
5cc3006a3a
@ -153,7 +153,7 @@ std::unique_ptr<IndexFile> RawCacheLoad(const std::string &path) {
|
||||
}
|
||||
|
||||
bool Indexer_Parse(DiagnosticsPublisher *diag_pub, WorkingFiles *working_files,
|
||||
Project *project, VFS *vfs) {
|
||||
Project *project, VFS *vfs, const GroupMatch &matcher) {
|
||||
std::optional<Index_Request> opt_request = index_request->TryPopFront();
|
||||
if (!opt_request)
|
||||
return false;
|
||||
@ -167,6 +167,11 @@ bool Indexer_Parse(DiagnosticsPublisher *diag_pub, WorkingFiles *working_files,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (std::string reason; !matcher.IsMatch(request.path, &reason)) {
|
||||
LOG_S(INFO) << "skip " << request.path << " for " << reason;
|
||||
return false;
|
||||
}
|
||||
|
||||
Project::Entry entry;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(project->mutex_);
|
||||
@ -259,6 +264,12 @@ bool Indexer_Parse(DiagnosticsPublisher *diag_pub, WorkingFiles *working_files,
|
||||
std::string path = curr->path;
|
||||
if (!(vfs->Stamp(path, curr->last_write_time) || path == path_to_index))
|
||||
continue;
|
||||
if (std::string reason; !matcher.IsMatch(path, &reason)) {
|
||||
LOG_S(INFO) << "skip emitting and storing index of " << path << " for "
|
||||
<< reason;
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG_S(INFO) << "emit index for " << path;
|
||||
prev = RawCacheLoad(path);
|
||||
|
||||
@ -307,8 +318,9 @@ void Init() {
|
||||
|
||||
void Indexer_Main(DiagnosticsPublisher *diag_pub, VFS *vfs, Project *project,
|
||||
WorkingFiles *working_files) {
|
||||
GroupMatch matcher(g_config->index.whitelist, g_config->index.blacklist);
|
||||
while (true)
|
||||
if (!Indexer_Parse(diag_pub, working_files, project, vfs))
|
||||
if (!Indexer_Parse(diag_pub, working_files, project, vfs, matcher))
|
||||
indexer_waiter->Wait(index_request);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user